/* Copyright 2014-2022 © Moxie Software. All Rights Reserved. Concierge Version: v1.32.0 */ !function(){"use strict";function e(e){return"function"==typeof e}var t,n,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,a=function(e,t){m[r]=e,m[r+1]=t,2===(r+=2)&&(n?n(w):g())};var o="undefined"!=typeof window?window:void 0,s=o||{},c=s.MutationObserver||s.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(w,1)}}var g,h,f,p,v,m=new Array(1e3);function w(){for(var e=0;e>>0;for(n=+n||0,Math.abs(n)===1/0&&(n=0),n<0&&(n+=i)<0&&(n=0);ni.length)&&(n=i.length),n-=t.length;var r=i.indexOf(t,n);return-1!==r&&r===n}function We(e){var t=".",n=Le(e=(""+e).trim(),"%"),i=(e=e.replace(/[^0-9.,]/g,"")).lastIndexOf(","),r=e.lastIndexOf(".");r>=0&&i>=0&&r1&&(t=""),e=(e=e.replace(new RegExp("[^0-9"+t+"]","g"),"")).replace(",",".");var a=parseFloat(e);return n&&(a/=100),a}function Re(e){var t=We(e);return isNaN(t)?We(e.replace(/\./g,"").replace(/,/g,".")):t}function Pe(e,t,n){return De(t)?function(e,t,n){if("number"==typeof e&&!isNaN(e)&&"number"==typeof n&&!isNaN(n))switch(t){case Ne:return e===n;case W:return en||!1===i)&&(r=e.journey.length-n)}return e.journey[r]}function Ve(e,t,n,i){void 0===i&&(i=!0);var r=0;switch(t){case 0:r=0;break;case 1:r=e.session.visits.length-1;break;case 2:n||(n=2),(e.session.visits.length>n||!1===i)&&(r=e.session.visits.length-n)}return e.session.visits[r]}function qe(e){return void 0===e?e:JSON.parse(JSON.stringify(e))}function He(e,t,n){e&&e[t]!==n&&(e[t]=n,e.dirty=!0)}function Be(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Je(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}var $e=String.prototype.valueOf,Ue=Object.prototype.toString,Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function ze(e){return"string"==typeof e||"object"==typeof e&&(Ge?function(e){try{return $e.call(e),!0}catch(e){return!1}}(e):"[object String]"===Ue.call(e))}var Ke=Math.pow(2,53)-1;function Xe(e){return"function"==typeof e||"[object Function]"===Ue.call(e)}function Qe(e){var t=function(e){var t=Number(e);if(isNaN(t))return 0;if(0===t||!isFinite(t))return t;return(t>0?1:-1)*Math.floor(Math.abs(t))}(e);return Math.min(Math.max(t,0),Ke)}function Ye(e,t,n){var i=arguments.length;if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r=Object(e);if(i>1&&!Xe(t))throw new TypeError("Array.from: when provided, the second argument must be a function");for(var a,o=Qe(r.length),s=Xe(Array)?Object(new Array(o)):new Array(o),c=0;c2?t.call(n,a,c):t(a,c):a,c+=1;return s.length=o,s}function Ze(e){var t=new Set;if(null!=e)for(var n=0;n!==e.length;n++)t.add(e[n]);return t}var et={name:"n",value:"V",quantity:"q",skuOrId:"s",uom:"u"};function tt(){return window.innerHeight}function nt(){return window.innerWidth}function it(){return tt()>window.visualViewport.height}function rt(e){return t=e,!isNaN(parseFloat(t))&&isFinite(t)?e+"px":e;var t}var at={top:rt,bottom:rt,left:rt,right:rt,height:rt,width:rt};function ot(e){var t=(e=e.toString()).indexOf("px");return t>0&&(e=Number(e.slice(0,t))),e}var st={top:ot,bottom:ot,left:ot,right:ot,height:ot,width:ot};function ct(e,t){var n=at[e];return n?n(t):t}function ut(e,t){var n=st[e];return n?n(t):t}function lt(e){var t=e.getBoundingClientRect();return{top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft}}function dt(e){return getComputedStyle(e,null)}function gt(e){var t=ot(dt(e).height);return""===t&&(t=e.getBoundingClientRect.height),t}function ht(e){var t=ot(dt(e).width);return""===t&&(t=e.getBoundingClientRect.width),t}function ft(e){var t=dt(e);if("none"==t.display)return!1;if("hidden"==t.visibility)return!1;var n=Vt(e);return!n||ft(n)}function pt(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];if(e&&void 0!==e.length)for(var r=0;r0;)n[i]=arguments[i+2];e&&void 0!==e.length&&e.length>0&&t.apply(void 0,[e[0]].concat(n))}function mt(e){return document.getElementById(e)}function wt(e,t){try{return e.querySelectorAll(t)}catch(e){return xe.error("Encountered error trying to select dom element with selector: '"+t+"' : "+e.message),document.createDocumentFragment().childNodes}}function yt(e,t){var n=e.length;if(t>=0){if(0===n)return e;if(0===t&&1===n)return e;if(n>t)return[e[t]]}return[]}function bt(e){return function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];var r=[];return pt(e,(function(e){t.apply(void 0,[e].concat(n))&&r.push(e)})),r}(e,ft)}function St(e){return function e(t,n){if(!n)return[];if(n.indexOf(",")>=0){var i=[];return n.split(",").forEach((function(n){i.push.apply(i,e(t,n.trim()))})),i}var r=n.match(/:(eq|first|last|visible)(\((\d+)\))?$/i);if(!r)return wt(t,n);var a=n.slice(0,r.index),o=r[1].toLowerCase();if("eq"==o){var s=r[3];return yt(wt(t,a),s)}return"first"==o?yt(wt(t,a),0):"last"==o?function(e){var t=e.length;return t>1?[e[t-1]]:e}(wt(t,a)):"visible"==o?bt(wt(t,a)):void 0}(document,e)}function Ct(e){Be(e,"remove")?e.remove():e.parentNode&&e.parentNode.removeChild(e)}function _t(e,t){e.innerHTML=t}function Et(e,t,n){e.insertAdjacentHTML(t,n)}function It(e,t){Et(e,"afterbegin",t)}function Ot(e,t){Et(e,"beforeend",t)}function xt(e,t){!function(e,t){Et(e,"afterend",t)}(e,t),Ct(e)}function Nt(e){pt(e.childNodes,Ct)}function Tt(e,t){e.appendChild(t)}function kt(e,t){e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):Tt(e,t)}function Dt(e){e.focus()}function Mt(e){e.blur()}function At(e){return function e(t,n){return t===n||!!n.parentNode&&e(t,n.parentNode)}(e.ownerDocument,e)}function Lt(e,t){return e.tagName===t}function Wt(e){var t=e.getAttribute("class");return null==t?[]:t.split(" ")}function Rt(e,t){var n=e.classList;return null==n?-1!==Wt(e).indexOf(t):e.classList.contains(t)}function Pt(e,t){return e.attributes&&null!==e.getAttribute(t)}var jt=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector;function Ft(e,t){return jt.call(e,t)}function Vt(e){return void 0===e.parentElement?e.parentNode:e.parentElement}function qt(e,t){return e.getAttribute(t)}function Ht(e,t,n){e.setAttribute(t,n)}function Bt(e,t){e.removeAttribute(t)}function Jt(e,t,n){e.style[t]=ct(t,n)}function $t(e,t){for(var n in t)Jt(e,n,t[n])}function Ut(e,t){e.style&&e.style.removeProperty(t)}var Gt=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&At(e)&&"none"===dt(e).display},zt=function(){return null},Kt=function(){},Xt={};function Qt(e){var t,n=e.ownerDocument,i=e.nodeName,r=Xt[i];return r||(r=dt(t=n.body.appendChild(n.createElement(i))).display,t.parentNode.removeChild(t),"none"===r&&(r="block"),Xt[i]=r,r)}function Yt(e,t){for(var n,i,r=[],a=0,o=e.length;a0;)t[n]=arguments[n+1];return function(n){if(n&&n.target)for(var i=n.target,r=n.currentTarget,a=i;null!==a&&!a.isEqualNode(r);){if(e.apply(void 0,[a].concat(t)))return[!0,a];a=Vt(a)}return[!1,null]}}function cn(e,t,n,i,r){var a=function(e){var t=n(e),a=t[0],o=t[1];a&&(null===o&&(o=this),!1===i.bind(o)(e)&&(e.stopPropagation(),r||e.preventDefault()))};return pt(e,r?an:rn,t,a),a}function un(e,t,n){pt(e,on,t,n)}function ln(e){return sn(Rt,e)}function dn(e){return sn(Lt,e.toUpperCase())}function gn(e){return sn(Ft,e)}function hn(e){var t=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i>>0)+bn+++"__";this.set=function(t,n){var i=t[e];return i&&i[0]===t?i[1]=n:Object.defineProperty(t,e,{value:[t,n],writable:!0}),this},this.get=function(t){var n=t[e];return n&&n[0]===t?n[1]:void 0},this.delete=function(t){var n=t[e];if(!n)return!1;var i=n[0]===t;return n[0]=n[1]=void 0,i},this.has=function(t){var n=t[e];return!!n&&n[0]===t}}var Cn=!1||"undefined"==typeof WeakMap?new Sn:new WeakMap;function _n(e){var t;return Cn.has(e)?t=Cn.get(e):(t={},Cn.set(e,t)),t}function En(e,t,n){var i=_n(e),r=i[t];return i[t]=n,r}function In(e,t){return _n(e)[t]}function On(e,t){delete _n(e)[t]}function xn(e,t){var n=In(e,t);return void 0===n&&(n=qt(e,"data-"+function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}(t))),n}function Nn(e){for(var t=hn({},_n(e)),n=e.attributes,i=0;i=0&&n.splice(i,1)}}(e.element,e.id),function(e){Mn.animations[e.id]&&(delete Mn.animations[e.id],Mn.aniCount-=1)}(e),e.curAniFrame&&((t=e.curAniFrame)&&(Ln(t),kn(t)),e.curAniFrame=!1),e.doneTimeout&&(Wn(e.doneTimeout),window.clearTimeout(e.doneTimeout),e.doneTimeout=!1)}var Pn=0,jn=function(e,t,n,i){Pn+=1,this.id=Pn,this.element=e,this.duration=t,this.doneHandler=n,this.label=i,this.startTime=null,this.doneTimeout=!1,this.curAniFrame=!1,this.animator=null,this.doneFunction=null};function Fn(e,t){var n=In(e,"_animations");if(n&&n.length){n=Ye(n);for(var i=0;i=c?1:n/c,r={};for(var o in t){var s=Number(ut(o,t[o]))-a[o];r[o]=ct(o,a[o]+s*i)}$t(this.element,r),n>=this.duration?this.done():this.curAniFrame=qn(this.animator,this.label)}.bind(l),c>0?(l.curAniFrame=qn(l.animator,l.label),l.doneTimeout=window.setTimeout(function(){Wn(l.doneTimeout),l.doneTimeout=!1,Rn(l);var e=Date.now();l.startTime=e-c,l.animator(e)}.bind(l),c),function(e,t){Mn.timeCount+=1,Mn.timeouts[e]=t||"unknown"}(l.doneTimeout,l.label),An(l)):l.animator(Date.now())}function qn(e,t){var n=Tn((function(t){Ln(n),e(t)}));return function(e,t){Mn.frameCount+=1,Mn.frames[e]=t||"unknown"}(n,t),n}jn.prototype.finish=function(){if(Rn(this),this.animator){var e=Date.now();this.startTime=e-this.duration,this.animator(e)}},jn.prototype.done=function(){if(Rn(this),this.doneHandler)try{this.doneHandler.call(this.element)}catch(e){xe.error("ERROR in animation done handler",e)}},jn.prototype.cancel=function(){Rn(this)};var Hn=null;function Bn(e){null===Hn&&(Hn=document.createElement("DIV")),It(Hn,e);var t=Ye(Hn.childNodes);return pt(t,Ct),t}var Jn=function(e){this.length=0,null==e||("string"==typeof e?e.length>0&&("<"===e.charAt(0)?this.pushAll(Bn(e)):this.pushAll(wt(document,e))):void 0!==e.length?this.pushAll(e):this.push(e))};function $n(e){return new Jn(e)}function Un(e,t){Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"AJAXError"}),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:e.statusText}),Object.defineProperty(this,"elapsed",{enumerable:!1,writable:!0,value:t}),Object.defineProperty(this,"request",{enumerable:!1,writable:!0,value:e}),Be(Error,"captureStackTrace")?Error.captureStackTrace(this,Un):Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:new Error(e.statusText).stack})}Jn.prototype.push=function(e){return e&&1===e.nodeType&&(this[this.length]=e,this.length+=1),this},Jn.prototype.pushAll=function(e){for(var t=0;t0;)t[n]=arguments[n+1];return pt.apply(void 0,[this,e].concat(t)),this},Jn.prototype.hasClass=function(e){return this.length>0&&Rt(this[0],e)},Jn.prototype.attr=function(e,t){var n=arguments.length;if(2===n)pt(this,Ht,e,t);else if(1===n){var i=this.length>0?qt(this[0],e):null;return null!==i?i:void 0}return this},Jn.prototype.removeAttr=function(e){return pt(this,Bt,e),this},Jn.prototype.data=function(e,t){var n=arguments.length;if(2===n)pt(this,En,e,t);else{if(1===n)return 0===this.length?void 0:xn(this[0],e);if(0===n)return 0===this.length?void 0:Nn(this[0])}return this},Jn.prototype.addClass=function(e){return pt(this,Zt,e),this},Jn.prototype.removeClass=function(e){return pt(this,en,e),this},Jn.prototype.on=function(e,t,n){var i=this,r=arguments.length;return 2===r&&"string"==typeof e&&"function"==typeof t&&e.split(" ").forEach((function(e){e&&pt(i,rn,e,t)})),3===r&&"string"==typeof e&&"string"==typeof t&&"function"==typeof n&&cn(this,e,gn(t),n,!1),this},Jn.prototype.onPassive=function(e,t,n){var i=arguments.length;return 2===i&&"string"==typeof e&&"function"==typeof t&&pt(this,an,e,t),3===i&&"string"==typeof e&&"string"==typeof t&&"function"==typeof n&&cn(this,e,gn(t),n,!0),this},Jn.prototype.css=function(e,t){var n=arguments.length;if(n>0){var i=typeof e;if(1===n){if("string"===i)return this.length>0?dt(this[0])[wn(e)]:null;if(Array.isArray(e)){for(var r={},a=dt(this[0]),o=0;o0&&(e=e[0]),pt(this,(function(t){Tt(e,t)})),this},Jn.prototype.html=function(e){return pt(this,_t,e),this},Jn.prototype.val=function(){return this.length>0?this[0].value||null:void 0},Jn.prototype.text=function(e){var t=arguments.length;if(0===t){var n=[];return pt(this,(function(e){e.textContent&&n.push(e.textContent)})),n.join("")}return 1===t&&this.length>0&&(this[0].textContent=e),this},Jn.prototype.prependHtml=function(e){return pt(this,It,e),this},Jn.prototype.remove=function(){return pt(this,Ct),this},Jn.prototype.find=function(e){var t=new Jn;return pt(this,(function(n){t.pushAll(wt(n,e))})),t},Jn.prototype.closest=function(e){var t=new Jn;return pt(this,(function(n){t.push(function(e,t){if(Element.prototype.closest)return e.closest(t);var n=e;do{if(Ft(n,t))return n;n=n.parentNode}while(null!==n&&1===n.nodeType);return null}(n,e))})),t},Jn.prototype.first=function(){var e=new Jn;return this.length>0&&e.push(this[0]),e},Jn.prototype.parent=function(){var e=new Jn;return this.length>0&&e.push(this[0].parentNode),e},Jn.prototype.children=function(e){var t=new Jn;return pt(this,(function(e){var n=e.childNodes;t.pushAll(n)})),e&&(t=t.filter(e)),t},Jn.prototype.index=function(){return this.length>0?function(e){var t=e.parentNode.childNodes,n=0;for(n=0;n0?gt(this[0]):0:(pt(this,$t,{height:e+"px"}),this)},Jn.prototype.width=function(e){return 0===arguments.length?this.length>0?ht(this[0]):0:(pt(this,$t,{width:e+"px"}),this)},Jn.prototype.sort=function(e){var t=Ye(this);t.sort(e);for(var n=0;n=0&&(c.addEventListener("loadstart",(function(){a=setTimeout((function(){a=!1,c.abort(),t(new Error("Operation timed out"))}),r.timeout)})),c.addEventListener("loadend",(function(){a&&clearTimeout(a)}))),c.addEventListener("load",(function(){c.status>=200&&c.status<400?e(c):t(new Un(c,Date.now()-n))})),c.addEventListener("error",(function(){t(new Un(c,Date.now()-n))})),c.send()})),e[i]=a,r.retainFor>0){var u=setTimeout(s,r.retainFor);t[i]=u}a.catch((function(){return s(),null}))}return a}this.retainFor=function(e){return(e=Number(e))>=0&&(n.retainFor=e),n.retainFor},this.timeout=function(e){return(e=Number(e))>=0&&(n.timeout=e),n.timeout},this.urls=function(){return Object.keys(e)},this.getXMLHttpRequest=function(e,t){return i(e,t)},this.get=function(e,t){return i(e,t).then((function(e){return"string"==typeof e.response?JSON.parse(e.response):e.response}))},this.remove=function(n){delete e[n],t[n]&&(clearTimeout(t[n]),delete t[n])},this.set=function(t,n){e[t]=L.resolve(n)},this.clear=function(){for(var n in t)clearTimeout(t[n]);e={},t={}}}var zn="function"==typeof CustomEvent?function(e,t){return new CustomEvent(e,{detail:t})}:function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n};function Kn(e,t,n){var i=zn("GoMoxie:"+e,t);return i.version=n,i}function Xn(e,t){var n=new Kn(e,t,"1.0");return setTimeout((function(){try{window.dispatchEvent(n)}catch(t){xe.log("PublicAPI.broadcast("+e+"): error: "+(t.stack?t.stack:t.message))}})),n}function Qn(e,t,n){var i,r,a,o,s,c,u;if(c={cartValue:!1,cartItems:!1},!t||!function(e){return!!(e&&e.session&&e.session.visits&&e.session.visits.length>=1)}(e))return e;if(o=e.session.visits.length-1,a=e.session.visits[o].journey.length-1,void 0!==t.currentCartValue&&(r=Number(t.currentCartValue),isNaN(r)||(e.session.visits[o].journey[a].current_cart_value=r,c.cartValue=r)),void 0!==t.currentCartItems&&(i=(u=t.currentCartItems)&&u.length>0?u.filter((function(e){if("name"in e&&""!==e.name||"sku_or_id"in e&&""!==e.sku_or_id)return!0})):[],e.session.visits[o].journey[a].current_cart_items=i,c.cartItems=i),void 0!==t.transactionTotal&&(s=Number(t.transactionTotal),isNaN(s)||(e.session.end_cart_value=s)),e.last_updated=Date.now(),c.cartValue||c.cartItems){var l=c.cartValue||r,d=c.cartItems||i;Xn("cartUpdated",{cartValue:l,cartItems:d}),le(n,l,d)}return e}function Yn(e){return-1!==["link"].indexOf(e)}function Zn(e,t){return new L((function(n,i){n(void 0===t?e():e.call(t))}))}function ei(e){return function(){var t=this,n=[].slice.call(arguments,0);return new L((function(i){i(e.apply(t,n))}))}}function ti(e){try{var t=window[e],n="__test__";return t.setItem(n,n),t.removeItem(n),!0}catch(e){return!1}}var ni=new Array(16);for(var ii,ri,ai=[],oi=0;oi<256;++oi)ai[oi]=(oi+256).toString(16).substr(1);var si=0,ci=0;function ui(e,t,n){var i=t&&n||0,r=t||[],a=(e=e||{}).node||ii,o=void 0!==e.clockseq?e.clockseq:ri;if(null==a||null==o){var s=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),ni[t]=e>>>((3&t)<<3)&255;return ni}();null==a&&(a=ii=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==o&&(o=ri=16383&(s[6]<<8|s[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:ci+1,l=c-si+(u-ci)/1e4;if(l<0&&void 0===e.clockseq&&(o=o+1&16383),(l<0||c>si)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");si=c,ci=u,ri=o;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;r[i++]=d>>>24&255,r[i++]=d>>>16&255,r[i++]=d>>>8&255,r[i++]=255&d;var g=c/4294967296*1e4&268435455;r[i++]=g>>>8&255,r[i++]=255&g,r[i++]=g>>>24&15|16,r[i++]=g>>>16&255,r[i++]=o>>>8|128,r[i++]=255&o;for(var h=0;h<6;++h)r[i+h]=a[h];return t||function(e,t){var n=t||0,i=ai;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}(r)}function li(e){return!0===e?"p":"s"}function di(e){return JSON.stringify(e)}function gi(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}}var hi=function(){this.name="DefaultStoragePlugin",this.data={p:{},s:{}}};hi.prototype.destroy=function(){},hi.prototype.clear=function(){this.data.p={},this.data.s={}},hi.prototype.has=function(e,t){return Be(this.data[li(t)],e)},hi.prototype.set=function(e,t,n){this.data[li(n)][e]=t},hi.prototype.del=function(e,t){delete this.data[li(t)][e]},hi.prototype.get=function(e,t){var n=li(t);return Be(this.data[n],e)?gi(this.data[n][e]):null},hi.prototype.removeKeysOtherThan=function(e,t){var n;n=t?this.data.p:this.data.s;var i=Object.keys(n);if(0!==i.length)for(var r=Ze(e),a=0;a!==i.length;a++){var o=i[a];r.has(o)||delete n[o]}};var fi=["rules_version","uuid","widgets_version"],pi=["chat-","conclient_","email-","kbot-","kb-","MoxieCache_","moxie","cxone-expert-"];function vi(e){if(Ae(fi,e,0)>=0)return!0;for(var t=0;t=0))if(!0===n)try{localStorage.setItem(e,di(t))}catch(t){xe.log("Error setting "+e+": "+t)}else try{sessionStorage.setItem(e,di(t))}catch(t){xe.log("Error setting "+e+": "+t)}},yi.prototype.get=function(e,t){if(this.parentStorage.has(e,t))return this.parentStorage.get(e,t);var n=!0===t?localStorage.getItem(e):sessionStorage.getItem(e);return null!==n&&(n=gi(n)),n},yi.prototype.del=function(e,t){this.parentStorage.del(e,t),!0===t?localStorage.removeItem(e):sessionStorage.removeItem(e)},yi.prototype.clear=function(){this.parentStorage.clear(),mi(localStorage),mi(sessionStorage)},yi.prototype.removeKeysOtherThan=function(e,t){var n;this.parentStorage.removeKeysOtherThan(e,t);for(var i=wi(n=t?localStorage:sessionStorage,e),r=0;r!==i.length;r++){var a=i[r];n.removeItem(a)}};var bi="moxie=".length,Si="!--moxie".length,Ci=window.top||window;function _i(e){var t="",n="",i=e.indexOf("moxie=");if(i>=0){i>0&&(t=e.slice(0,i));var r=e.indexOf("!--moxie",i+bi);r>=0?(n=e.slice(i+bi,r),t+=e.slice(r+Si)):n=e.slice("moxie=".length)}return[t,n]}function Ei(e){var t=_i(Ci.name||"");Ci.name=t[0]+"moxie="+JSON.stringify(e)+"!--moxie"}var Ii=function(e,t){this.name="WindowNameStoragePlugin",this.parentStorage=e,this.clientName=t.clientName,this._data=function(e){var t=_i(Ci.name||"")[1],n={};if(t.length>0)try{n=JSON.parse(t)}catch(e){xe.log("JSON: unable to parse window.name value:",t)}return n[e]||(n[e]={p:{},s:{}}),n}(this.clientName);var n,i=this;this.saveItListener||(this.saveItListener=function(){Ei(i._data)},Ci.addEventListener("unload",this.saveItListener,!1));var r=i._data[this.clientName];for(n in r.p)e.set(n,r.p[n],!0);for(n in r.s)e.set(n,r.s[n],!1)};function Oi(e){var t=e.widgetManager,n=e.cacheManager;return e._clearingHistoryPromise||(e._clearingHistoryPromise=L.resolve(!0).then((function(){return e.contextMonitor.stop(),t.clearHistory().then((function(){t.destroy()})).then((function(){var t=e.eventService;return e.eventService={clearHistoryStub:!0,notifyEventServiceImmediately:function(){},notifyEventService:function(){}},L.resolve(t.stopEventService())})).then((function(){return L.resolve(n.storagePlugin.clear()).then((function(){n.destroy(),e.cacheManager=null}))})).catch((function(e){throw xe.log("History.clearHistory received an error:",e),e}))}))),e._clearingHistoryPromise}function xi(e){var t=e.userAgent.toString().toLowerCase(),n=e.appName,i=/(dolfin)[ /]([\w.]+)/.exec(t)||/(javafx)[/]([\w.]+)/.exec(t)||/(chrome)[ /]([\w.]+)/.exec(t)||/(opera)(?:.*version)?[ /]([\w.]+)/.exec(t)||/(webkit)(?:.*version)?[ /]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(t)||["","unknown"];return"webkit"===i[1]?i=/fbav|instagram/.test(t)&&/(iphone|ipad|ipod)/.test(t)?[i[0],"safari",i[2]]:/(iphone|ipad|ipod)\/?\s*(\.?\d+(\.\d+)*)/.exec(t)||/(android)[ /]([\w._-]+);/.exec(t)||[i[0],"safari",i[2]]:"mozilla"===i[1]?/trident/.test(t)?i[1]="MSIE":i[1]="firefox":/polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(t)&&(i[1]="Polaris"),[i[1].toLowerCase(),"unknown"===i[2]?[n,window.navigator.appVersion,"-?"]:i[2]]}Ii.prototype.destroy=function(){this.parentStorage.destroy(),this.saveItListener&&(Ci.removeEventListener("unload",this.saveItListener),delete this.saveItListener)},Ii.prototype.has=function(e,t){return this.parentStorage.has(e,t)},Ii.prototype.set=function(e,t,n){if(this.parentStorage.set(e,t,n),!this.skipSaveForKey||!this.skipSaveForKey(e)){var i=!1;!0===n?(this._data[this.clientName].p[e]!==t&&(i=!0),this._data[this.clientName].p[e]=t):(this._data[this.clientName].s[e]!==t&&(i=!0),this._data[this.clientName].s[e]=t),i&&Ei(this._data)}},Ii.prototype.get=function(e,t){var n=!0===t?this._data[this.clientName].p[e]:this._data[this.clientName].s[e];if(void 0!==n)try{return JSON.parse(n)}catch(e){return n}return this.parentStorage.has(e,t)?(n=this.parentStorage.get(e,t),this.skipSaveForKey&&this.skipSaveForKey(e)?n:(!0===t?this._data[this.clientName].p[e]=n:this._data[this.clientName].s[e]=n,Ei(this._data),n)):null},Ii.prototype.del=function(e,t){this.parentStorage.del(e,t),!0===t?delete this._data[this.clientName].p[e]:delete this._data[this.clientName].s[e],Ei(this._data)},Ii.prototype.clear=function(){this.parentStorage.clear(),this._data[this.clientName].p={},this._data[this.clientName].s={},Ei(this._data)};var Ni={},Ti=0,ki={},Di=0,Mi={},Ai={};var Li=!1;function Wi(){Li||(xe.error("Double load of concierge suspected"),Li=!0)}function Ri(e,t){var n=++Di;return t.bridgeName="storage_bridge",t.requesterId=e.id,t.requestId=n,t.client=e.concierge.clientName,t.signature="moxie_concierge",e&&e.ifrm&&e.ifrm.contentWindow&&e.ifrm.contentWindow.postMessage?(function(){if("function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}}(),e.ifrm.contentWindow.postMessage(JSON.stringify(t),"*"),new L((function(i,r){var a=setTimeout((function(){if(a=!1,r(new Error("TIMEOUT waiting for shared storage.")),e.concierge.isTestMode){var t=new CustomEvent("stopWriting");document.dispatchEvent(t)}}),6e3);if(e.concierge.isTestMode){var o=new CustomEvent("storagePost");document.dispatchEvent(o)}var s=function(){a&&(clearTimeout(a),a=!1)};Mi[n]={message:t,resolve:function(e){s(),i(e)},reject:function(e){s(),r(e)}}})).finally((function(){delete Mi[n]}))):(Wi(),L.resolve(!0))}function Pi(e,t){this.useSharedStorage=!1,this.parentStorage=e,this.concierge=t,this.scriptLocation=t.scriptLocation,this.created=Date.now(),this.sharedStorageId=function(e){var t=ki[e];return t||(t="concierge-shared-storage",++Ti>1&&(t=t+"-"+Ti),ki[e]=t),t}(this.scriptLocation),this.id=Date.now()}function ji(e){this.name="InvalidArgumentException",this.message=e,this.toString=function(){return this.name+": "+this.message}}function Fi(e){return Le(e,"_file")&&e.indexOf("profileJSON")<0||"Rules"===e||"engagementWidgets"===e}function Vi(e,t,n,i){return L.resolve(e.storagePlugin.set(t,n,i))}Pi.prototype.destroy=function(e){e&&this.parentStorage.destroy(),Ct(this.ifrm),this.removeListener?(this.removeListener(),delete this.ifrm):Wi()},Pi.prototype.init=function(){var e=this;if(Ni[this.id]=this,this.data={p:{},s:{}},e.ifrm=mt(e.sharedStorageId),!e.ifrm){e.ifrm=document.createElement("iframe"),e.ifrm.setAttribute("id",e.sharedStorageId),e.ifrm.setAttribute("tabindex","-1");var t=e.scriptLocation+"/client/storage_bridge.html";e.ifrm.setAttribute("src",t),e.ifrm.setAttribute("sandbox","allow-scripts allow-same-origin");var n=function(t){if("."===e.scriptLocation||0===e.scriptLocation.indexOf(t.origin)){var n={};try{n="string"==typeof t.data?JSON.parse(t.data):t.data}catch(e){}if(n&&"storage_bridge"===n.bridgeName){var i,r,a,o=e;if(n.requesterId&&Ni[n.requesterId]&&(o=Ni[n.requesterId]),n.requesterId===o.id)n.error?(i=n.requestId,r=new Error("Error from shared storage: "+n.error.message),(a=Mi[i])?a.reject(r):xe.log("SharedStorageBridge: rejectRequest("+i+", "+JSON.stringify(r)+") cannot find outstanding request")):"updated"===n.request?(xe.log("CONCIERGE StoragePlugin update: ",n),"moxie_cc"!==n.key||n.newValue||Oi(e.concierge).catch((function(e){xe.log("ERROR clearing history"+e)}))):function(e,t){var n=Mi[e];n?n.resolve(t):xe.log("SharedStorageBridge: resolveRequest("+e+", "+JSON.stringify(t)+") cannot find outstanding request")}(n.requestId,n);else Li||xe.log('CONCIERGE StoragePlugin request ID mismatch: plug in "'+o.id+'" receved an event for "'+n.requesterId+'"')}}};e.removeListener=function(){window.removeEventListener("message",n,!1)},Ai[e.scriptLocation]=new L((function(t){e.ifrm.onload=function(e){e.target&&e.target.src&&t(e)}})).then((function(){window.addEventListener("message",n,!1)})),e.ifrm.style.display="none",document.body.appendChild(e.ifrm)}return Ai[e.scriptLocation].then((function(){var t="safari"===xi(window.navigator)[0];return Ri(e,{request:"init",shadowInSessionStorage:t}).then((function(t){for(var n in e.parentStorage.removeKeysOtherThan(Object.keys(t.lsValue),!0),e.parentStorage.removeKeysOtherThan(Object.keys(t.ssValue),!1),t.lsValue)e.parentStorage.set(n,t.lsValue[n],!0);for(var i in t.ssValue)e.parentStorage.set(i,t.ssValue[i],!1);e.useSharedStorage=!0})).catch((function(t){throw xe.log("SharedStoragePlugin#init: Failed to load from shared storage, removing listener: "+t.message),e.removeListener(),t}))}))},Pi.prototype.name="SharedStoragePlugin",Pi.prototype.has=function(e,t){return this.parentStorage.has(e,t)},Pi.prototype.get=function(e,t){return this.parentStorage.get(e,t)},Pi.prototype.clear=function(){this.parentStorage.clear();return Ri(this,{request:"clear"}).then((function(e){return"ack"===e.request}))},Pi.prototype.set=function(e,t,n){if(this.parentStorage.set(e,t,n),!this.skipSaveForKey||!this.skipSaveForKey(e))return Ri(this,{request:"store",key:e,value:t,persist:!0===n}).then((function(e){return"ack"===e.request}))},Pi.prototype.del=function(e,t){return this.parentStorage.del(e,t),Ri(this,{request:"remove",key:e,persist:!0===t}).then((function(e){return"ack"===e.request}))};var qi=0;function Hi(e){this.id=++qi,this.concierge=e,this.storagePlugin=this.defaultStoragePlugin=new hi;var t=ti("sessionStorage");ti("localStorage")&&t?(this.storagePlugin=new yi(this.defaultStoragePlugin),this.storagePluginToLoad="SharedStorage"):this.storagePluginToLoad="window.name",this.eventSerialNumber=null,this.saveEventSerialNumber=null,t&&(this.saveEventSerial=this.storeEventSerialNumberSessionStorage,this.eventSerialNumber=this.readEventSerialNumberFromSessionStorage())}function Bi(e,t,n){return L.resolve(e.storagePlugin.del(t,n))}function Ji(e){return"MoxieCache_"+e+"_file"}function $i(e){if(e&&(delete e.last_updated,delete e.last_submitted,e.session&&e.session.visits)){var t=e.session.visits.length-1;if(t>=0){var n=e.session.visits[t].journey;if(n){var i=n.length-1;i>=0&&(e.session.visits[t].journey[i].end_time=0)}}}}function Ui(e){var t=Ji("profileJSON");return function(e,t){return L.resolve(e.storagePlugin.get(t,!0)).then((function(e){return e?void 0===e.contents?(xe.log("Loaded "+t+" from localStorage, but .contents was undefined"),null):(xe.log("Loaded "+t+" from localStorage"),e.contents):null}))}(e,t).then((function(e){if(null!==e)try{return JSON.parse(e)}catch(e){xe.log("Error parsing profile: "+e.message)}return null})).then((function(t){if(null!==t)return e.setData("profileJSON",JSON.stringify(t),!0)})).then((function(){return e}))}function Gi(e){return function(e){return e.storagePlugin.get("moxie_cc",!0)||e.storagePlugin.get("uuid",!0)}(e)?e.autoLoadProperties().then(Ui).then((function(){return e})):function(e){xe.log("Creating new identity");var t=e.makeProfileId();return L.all([Vi(e,"uuid",t,!0),Vi(e,"moxie_cc",t+"|2147483647",!0)]).then((function(){return e.uuid=t,e}))}(e).then(Ui).then((function(){return e}))}Hi.prototype.storeEventSerialNumberSessionStorage=function(e){window.sessionStorage.setItem("moxie_concierge_event_serial_number",JSON.stringify(e))},Hi.prototype.readEventSerialNumberFromSessionStorage=function(){var e=window.sessionStorage.getItem("moxie_concierge_event_serial_number");if(null==e||""===e)return null;var t=null;try{t=JSON.parse(e)}catch(e){return xe.log("Could not read serial number from session storage: "+e.message),null}return"number"!=typeof t?null:Math.floor(t)!==t?null:t<0||t>4294967295?null:t},Hi.prototype.makeEventSerialNumber=function(){null===this.eventSerialNumber&&(this.eventSerialNumber=Math.floor(Math.random()*(Math.pow(2,32)-1)));var e=this.eventSerialNumber++;return this.saveEventSerial&&this.saveEventSerial(this.eventSerialNumber),this.eventSerialNumber>4294967295&&(this.eventSerialNumber=0),e},Hi.prototype.cleanup=function(){delete this.profileJSON,delete this.uuid},Hi.prototype.destroy=function(){this.cleanup(),this.storagePlugin.destroy()},Hi.prototype.skipSaveForKey=Fi,Hi.prototype.isValidUserProfile=function(e){return void 0!==e.session&&void 0!==e.session.id},Hi.prototype.getVisitorProfileId=function(){return this.getDataClone("uuid")},Hi.prototype.emitEvent=function(e){var t;return"function"==typeof CustomEvent?t=new CustomEvent(e):(t=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{}),xe.log("CacheManager: emitting profile update event: "+JSON.stringify(t)),this.dispatchEvent(window,t)},Hi.prototype.dispatchEvent=function(e,t){return e.dispatchEvent(t)},Hi.prototype.resetVisitorProfile=function(){var e=this;return this.concierge.contextMonitor.stop(),Bi(this,Ji("profileJSON"),!0).then((function(){e.visitorProfile=null;var t=e.concierge.contextMonitor.createNewProfile();return e.setData("profileJSON",JSON.stringify(t))})).then((function(){e.concierge.contextMonitor.start()}))},Hi.prototype.setData=ei((function(e,t,n){if(!ze(t))throw new ji("Cannot set "+e+", data must be a string.");if("profileJSON"===e){var i,r=this.getDataClone("profileJSON");try{i=JSON.parse(t)}catch(t){throw new ji("Cannot set "+e+", data is invalid JSON.")}var a=!1,o=!n&&function(e,t){var n=!1;if(e&&e.session&&e.session.visits&&e.session.visits.length>0){var i=e.session.visits.slice(-1)[0];if(i.journey&&i.journey.length>0){var r=i.journey.slice(-1)[0];new Date-new Date(r.end_time)>60*t*1e3&&(n=!0)}else n=!0}else n=!0;return n}(r,30),s=!1;if(n||null!=r){if(void 0!==i.customData)if(r&&void 0!==r.customData)JSON.stringify(r.customData)!==JSON.stringify(i.customData)&&(s=!0);else s=!0}else a=!0,void 0!==i.customData&&(s=!0);return a&&we(this.concierge),o&&ye(this.concierge),s&&Se(this.concierge,i.customData),this.storeProfile(t)}if(e===P)return this[P]=t,Vi(this,P,t,!0);if("rules_version"===e)return this.rules_version=t,Vi(this,"rules_version",t,!0);if("widgets_version"===e)return this.widgets_version=t,Vi(this,"widgets_version",t,!0);throw new ji("Cannot set "+e+", unknown property.")})),Hi.prototype.storeProfile=ei((function(e){var t,n=JSON.parse(e);if(this.isValidUserProfile(n)){this.profileJSON=n;var i=(t=0,{contents:e,timestamp:(new Date).getTime(),version:t});return Vi(this,Ji("profileJSON"),i,!0)}throw new ji("Cannot store profile, it is not valid.")})),Hi.prototype.setVolatileData=ei((function(e,t){if("moxie_channels_custom_data"===e||"moxie_channels_form_data"===e)return this[e]=t;throw new ji("Cannot set "+e+".")})),Hi.prototype.getVolatileData=function(e){return this[e]},Hi.prototype.profileUpdated=function(e){var t=this.getDataClone("profileJSON"),n=qe(e);return $i(n),$i(t),JSON.stringify(t)!==JSON.stringify(n)},Hi.prototype.getData=function(e){var t=this[e];return t?"object"==typeof t?qe(this[e]):this[e]:null},Hi.prototype.getDataClone=function(e){return this.getData(e)},Hi.prototype.getDataObject=function(e){return this[e]?this[e]:null},Hi.prototype.removeClientCache=function(e,t){return Bi(this,"conclient_"+e,t)},Hi.prototype.setClientCache=function(e,t,n){return Vi(this,"conclient_"+e,t,n)},Hi.prototype.getClientCache=function(e,t){return this.storagePlugin.get("conclient_"+e,t)},Hi.prototype.removeWidgetCache=function(e,t,n){return Bi(this,e+"-"+t,n)},Hi.prototype.setWidgetCache=function(e,t,n,i){return Vi(this,e+"-"+t,n,i)},Hi.prototype.getWidgetCache=function(e,t,n){return this.storagePlugin.get(e+"-"+t,n)},Hi.prototype.clearWidgetCacheKey=function(e,t){for(var n=[],i=this.storagePlugin;i.parentStorage;)i=i.parentStorage;var r,a=t?"p":"s",o=Object.keys(i.data[a]);for(r=0;r0&&(clearInterval(t),t=0)}}Yi.prototype.cleanup=function(){this.stop()},Yi.prototype.evalRules=function(){this.monitoredRules.forEach((function(e){this.rulesEngine.evalRule(e)?(this.rulesEngine.queueActions(e),this.unregister(e),e.monitor=!1):this.rulesEngine.rulesSucceeded[e.id]&&this.unregister(e)}),this)},Yi.prototype.fetchLocation=function(){return this.concierge.httpGet(this.concierge.serviceUrl.location,{type:"GET"}).then((function(e){var t=e.subdivisions&&e.subdivisions.length?e.subdivisions[0].names.en:"";return{city:e.city?e.city.names.en:"",state:t,country:e.country?e.country.names.en:"",ip_address:"",zip:"",longitude:e.location?e.location.longitude:"",latitude:e.location?e.location.latitude:""}}))},Yi.prototype.recordEngagementValue=function(){var e=this.cacheManager.getDataClone("profileJSON"),t=Fe(Ve(e,1),1).current_cart_value;return void 0===e.session.first_engagement_cart_value&&(e.session.dirty=!0,e.session.first_engagement_cart_value=t),void 0===e.session.visits[e.session.visits.length-1].first_engagement_cart_value&&(e.session.visits[e.session.visits.length-1].first_engagement_cart_value=t),this.cacheManager.setData("profileJSON",JSON.stringify(e))},Yi.prototype.parseMappedContext=function(e){if(void 0!==e){"string"==typeof e&&(e=[e]);var t=function(e,t){t.replace(/^\$\[/,"").replace(/\]\$$/,"");var n=$n(St(t)),i=n.text()||n.val();return i?i.trim():""};for(var n in e)Be(e,n)&&"string"==typeof e[n]&&(e[n]=e[n].replace(/\$\[(.*?)\]\$/g,t));return e}},Yi.prototype.initTracking=function(){var e,t=0,n=0,i=this.cacheManager.getDataClone("profileJSON"),r=!1,a=!1,o=xi(navigator);Qi={name:o[0],version:o[1]},Xi=J(navigator);var s=Number(this.cacheManager.getData(P)),c=this;if(null==i)(i={id:this.cacheManager.getData("uuid"),dirty:!0,tags:null,ip_address:"",all_device_names:[],all_browsers:[{name:Qi[0],version:Qi[1],language:navigator.language}],all_locations:null,preferences:{never_invite_to_chat:!1,language:navigator.language},session:null,history:{visits:0,last_visit:Date.now(),articles_viewed:0,invited_chat:0,refused_chat:0},last_updated:Date.now(),last_submitted:0}).all_device_names.push(Xi),r=!0,a=!0;else{if(Number(Fe(Ve(i,1),1).end_time)2592e3||isNaN(u))&&(i.session=null)}null!==i.session&&0!==i.session.visits.length&&((n=je(Fe(Ve(i,1),1).end_time))>1800||isNaN(n))&&(a=!0)}if(null===i.session||void 0===i.session){var l={};l.id=ui(),l.visits=[],l.dirty=!0,l.end_cart_value=0,i.session=l,r=!0,a=!0}if(a){var d={};d.id=ui(),d.dirty=!0,d.journey=[],d.browser={name:Qi[0],version:Qi[1],language:navigator.language},d.device={},d.device.name=J(navigator),d.referral={url:document.referrer.substr(0,200)},d.journey=[],i.session.visits.push(d),i.history.visits+=1,r=!0}var g={};g.id=ui(),g.dirty=!0,g.url=this.concierge.url.substr(0,200),g.title=this.concierge.pageTitle.substr(0,200),g.start_time=Date.now(),g.end_time=Date.now(),g.referral={url:document.referrer.substr(0,200)};var h=Fe(Ve(i,1),1),f=h&&h.current_cart_value?h.current_cart_value:0;if(void 0!==this.moxieData.customData&&this.concierge.publicAPI.customData(this.concierge,this.moxieData.customData),void 0!==this.moxieData.currentCartValue){g.current_cart_value=this.moxieData.currentCartValue;var p=this.moxieData.currentCartItems||(h&&h.current_cart_items?h.current_cart_items:[]);Xn("cartUpdated",{cartValue:this.moxieData.currentCartValue,cartItems:p}),le(this.concierge,this.moxieData.currentCartValue,p)}else g.current_cart_value=f;if(void 0!==this.moxieData.currentCartItems){var v;for(g.current_cart_items=[],v=0;v0&&(e.isRunning=!0,e.whenDone=new L((function(t){e.finishedRunning=t})),setTimeout((function(){return e.isRunning?e.next().catch(rr):null}))),this.whenDone}},sr.prototype.ActionLibrary=ar,sr.prototype.CriteriaLibrary=or;var cr=function(e,t){return void 0===e?e:t?!e:e},ur=function(e,t,n){return e?[n,t]:[t,n]},lr=function(e,t,n){var i,r,a,o,s,c,u,l,d,g,h,f,p,v,m,w,y,b,S,C,_,E=n[0],I=n[2],O=n[5];if(1e3===E){for(var x=!0,N=0;N0)||(A=(l=ur(R,M,I))[0],L=l[1],D=Pe(A,ke(E,W),L),cr(D,O)));case 9:return M=e.numberOfPagesVisited(),A=(d=ur(R,M,I))[0],L=d[1],D=Pe(A,ke(E,W),L),cr(D,O);case 10:return M=e.geographicLocationItem("city"),A=(g=ur(R,M,I))[0],L=g[1],D=Pe(A,ke(E,W),L),cr(D,O);case 11:return M=e.geographicLocationItem("state"),A=(h=ur(R,M,I))[0],L=h[1],D=Pe(A,ke(E,W),L),cr(D,O);case 12:return M=e.geographicLocationItem("country"),A=(f=ur(R,M,I))[0],L=f[1],D=Pe(A,ke(E,W),L),cr(D,O);case 13:return M=e.numberOfTimesPageViewed(),A=(p=ur(R,M,I))[0],L=p[1],D=Pe(A,ke(E,W),L),cr(D,O);case 14:return M=e.referralURL(),A=(v=ur(R,M,I))[0],L=v[1],D=Pe(A,ke(E,W),L),cr(D,O);case 15:return M=e.lastPageVisitedItem("url"),A=(m=ur(R,M,I))[0],L=m[1],D=Pe(A,ke(E,W),L),cr(D,O);case 16:return M=e.lastPageVisitedItem("title"),A=(w=ur(R,M,I))[0],L=w[1],D=Pe(A,ke(E,W),L),cr(D,O);case 17:case 18:if((M=18===W?e.previouslyVisitedItems("title"):e.previouslyVisitedItems("url"))&&M.length){D=!1;for(var X=0;X=1,O);case 1001:return M=e.elementValue(P),De(E=ke(E,W,I))&&isNaN(Re(M.value))&&(M.value="",M.text&&(isNaN(Re(M.text))||(M.value=M.text,delete M.text))),""!==M.value&&(!(D=Pe(A=(S=ur(R,M.value,I))[0],E,L=S[1]))&&M.text&&(D=Pe(A=(C=ur(R,M.text,I))[0],E,L=C[1])),cr(D,O));case 1002:return null!=(M=e.customValue(P))&&""!==M&&(A=(_=ur(R,M,I))[0],L=_[1],void 0!==(D=Pe(A,ke(E,W,I),L))&&cr(D,O));default:return xe.error("Unknown Scope/Criteria input value:",W),!1}}catch(e){var Q=t[0];return xe.error('Moxie Concierge Client: Scope/Criteria Eval Error ("'+Q+'" input:'+W+"): "+e.message),!1}},dr=function(e,t){var n=t[3];return null===n||lr(e,t,n)},gr=function(e){var t=e[6];return{name:e[0],id:e[1],source:"offer",monitor:e[2],action:{success:e[5]},criteria:e[6],ruleArray:e,hasEvent:!!t}},hr=function(e,t,n){var i=this,r=$n(St(t)),a=r.length,o=function(t){i.evalRule(e,!0)&&i.queueActions(e)},s=!0;return this.isTestMode&&(s=-1===window.location.search.indexOf("noDirectEventHandlers")),s&&pt(r,(function(e){an(e,n,o),i.eventListenerArgs.push([e,[n,o]])})),a};function fr(e){for(var t=e.type,n=this.bodyEventListeners[t],i=[],r=0;r!==n.length;r++){for(var a=n[r],o=this.siteRules.rules[a][6],s=!1,c=0;c!==o.length&&!s;c++){var u=o[c],l=u[0];if(-1!==u[1].indexOf(t)){var d=St(l);if(0!==d.length)for(var g=e.target;null!=g&&!s;){for(var h=0;h!==d.length&&!s;h++){s=d[h].isSameNode(g)}g=g.parentNode}}}s&&i.push(a)}for(var f=0;f!==i.length;f++){var p=i[f],v=this.ruleObjectsByIndex[p];this.evalRule(v,!0)&&this.queueActions(v)}}sr.prototype.removeAllEventListeners=function(){this.eventListenerArgs.forEach((function(e){var t=e[0],n=e[1];on.apply(void 0,[t].concat(n))}))},sr.prototype.init=function(e){var t=this;this.siteRules=e,this.actionLibrary=new ar(this.concierge),this.criteriaLibrary=new or(this.concierge),this.bodyEventListeners={},this.ruleObjectsByIndex=[],this.eventListenerArgs=[];for(var n=0;n=0?this.siteRules.settings.queue_wait_time:5},sr.prototype.minTimeBetween=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.min_time_between>=0?this.siteRules.settings.min_time_between:60},sr.prototype.hideWhenServiceLineClosed=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.hide_on_demand_chat_when_service_line_is_closed},sr.prototype.checkQueueWaitTimeForReactive=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.use_min_time_between_for_on_demand_chat},sr.prototype.checkQueueWaitTimeForProactive=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.use_min_time_between_for_proactive_chat},sr.prototype.run=function(){var e,t,n;for(e=[],t=0;t0}(e))return xe.log("wmStateCanMakeOffer false because DFO chat is active"),!1;var n=wr(e,t);if(n){var i=V(mr(e,n),"widget");if(i&&!i.hasFinished&&0!==i.state)return!1}return!0}function br(e){return!!e.offer}function Sr(e){return!!e.open}function Cr(e){return!!e.notification}function _r(e,t){return Yr(t)?function(e,t){if(null===t.preferredSpotName())return!0;var n=mr(e,t.spot);if(n){if(!n.widget)return!0;if(Fr(e,n.widget))return!1;if(n.widget.hasFinished)return!0;if(n.widget.priorityt.priority||0===t.state))}(e,r.widget,t))&&Ir(e,t))}function Nr(e,t){var n=t.parameters;n.rule=n.rule||{},n.proactive=!0;var i=t.label();if(function(e){var t=1e3*e.rulesEngine.minTimeBetween();if(t<=0)return!1;return Date.now()=0:e.active.filter((function(e){return e.name===F})).length>0}function Vr(e,t){Ae(e.alive,t)<0&&e.alive.push(t)}function qr(e,t){var n=Ae(e.alive,t);n>=0&&e.alive.splice(n,1)}function Hr(e,t){var n=e.wm.concierge.cacheManager.getClientCache("drag_position",!0);return n&&n.left&&n.top&&n.initialElemData&&n.initialConfigData&&t.name!=F&&(e.wm.isDragConfigDataEqualToCurrent(n.initialConfigData)?(e.wm.widgetAreaDragData.x=n.left,e.wm.widgetAreaDragData.y=n.top,e.wm.widgetAreaDragData.initialElemData=n.initialElemData,e.wm.widgetAreaDragData.draggedByUser=!0):e.wm.concierge.cacheManager.removeClientCache("drag_position",!0)),Fr(e,t)?L.resolve(null):(t.active=!0,e.active.push(t),Xn("widgetActivated",{widgetName:t.name}),Jr(e))}function Br(e,t){if(t.name!=F){var n=Ae(e.active,t);n>=0&&(t.active=!1,e.active.splice(n,1),Jr(e))}else t.active=!1,e.active=e.active.filter((function(e){return e.name!=F})),Jr(e);0===e.active.length&&e.wm.concierge.cacheManager.removeClientCache("drag_position",!0)}function Jr(e){var t=e.active.map((function(e){return{widgetName:e.name,loadParams:e.parameters}}));return e.wm.concierge.cacheManager.setClientCache("activeWidgets",t)}function $r(e){return 9===e}function Ur(e){return 13===e}function Gr(e){return 32===e}function zr(e){return 38===e}function Kr(e){return 40===e}var Xr=["onafterprint","onbeforeprint","onbeforeunload","onerror","onhashchange","onload","onmessage","onoffline","ononline","onpagehide","onpageshow","onpopstate","onresize","onstorage","onunload","onblur","onchange","oncontextmenu","onfocus","oninput","oninvalid","onreset","onsearch","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onwheel","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","onscroll","oncopy","oncut","onpaste","onabort","oncanplay","oncanplaythrough","oncuechange","ondurationchange","onemptied","onended","onerror","onloadeddata","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onratechange","onseeked","onseeking","onstalled","onsuspend","ontimeupdate","onvolumechange","onwaiting","ontoggle"];function Qr(e){return"externalAPI"===e||"externalLink"===e}function Yr(e){return Qr(V(e,"parameters","rule","source"))}var Zr={status:!1};function ea(e){return"kbot"===e}function ta(e){return function(e){return"chat"===e}(e)||ea(e)}function na(e){return function(e){return"kbot"===e||e==F}(e)?"chat":e}function ia(e){return!!e.engagementWidgets.globalSettings.singleChannelMode}function ra(e,t){var n=mr(e,t.spot);return!n||(!n.widget||t!==n.widget&&(!Fr(e,n.widget)&&(!!t.parameters&&!!function(e,t){if(!e||!t)return!0;var n=e.parameters,i=t.parameters;if(!n||!i)return!1;if(e.name!==t.name)return!0;switch(e.name){case"chat":if(parseInt(n.portalId,10)!==parseInt(i.portalId,10))return!0;break;case"kb":if(parseInt(n.portalId,10)!==parseInt(i.portalId,10))return!0;if(""+n.searchText!=""+i.searchText)return!0;if(""+n.articleId!=""+i.articleId)return!0;break;case"cxone-expert":if(parseInt(n.siteId,10)!==parseInt(i.siteId,10))return!0;if(""+n.searchText!=""+i.searchText)return!0;if(""+n.articleUrl!=""+i.articleUrl)return!0;if(""+n.touchpointId!=""+i.touchpointId)return!0;break;case"email":if(parseInt(n.mailboxId,10)!==parseInt(i.mailboxId,10))return!0}return!1}(n.widget,t))))}function aa(e){return $n('#concierge-widgets ul li[data-spot="'+e+'"]')}function oa(e){if(void 0!==e){var t,n;try{t=e.width.animVal.value,n=e.height.animVal.value}catch(e){return!1}qt(e,"viewBox")||Ht(e,"viewBox","0 0 "+t+" "+n),Ht(e,"height",25),Ht(e,"width",25)}}function sa(e,t){var n=L.resolve(),i=e.wmState.open;if(!i)return n;var r=$n("#concierge-widget-area");r.removeClass("con-open"),e.widgetsType.closeWidgets&&e.widgetsType.closeWidgets();var a=i.name;return e.$concierge.find("#concierge-widgets li[data-widget="+a+"] .con-icon").attr("aria-expanded","false"),"Tablet"===e.device&&(r.hasClass("con-animating")&&(n=n.then((function(){return r.promise()}))),n=n.then((function(){e.makePositionFixed(),e.forceBlur()}))),e.$concierge.removeClass("con-open-widget"),e.openWidget=!1,e.wmState.open=null,n.then((function(){if(e.widgetsType.focusWidgetButton(a),t)return Xn("widgetClosed",{widgetName:a})})).catch((function(e){xe.log("Error Closing Widget:"+e)}))}function ca(e){var t;void 0===e&&(e="");try{t=(new DOMParser).parseFromString(e,"text/html")}catch(t){return xe.error("DomParser failed to parse:",e,"with error:",t),""}return Ye(t.getElementsByTagName("*")).forEach((function(e){"SCRIPT"===e.nodeName?e.parentElement.removeChild(e):Xr.forEach((function(t){e.removeAttribute(t)}))})),t.documentElement.outerHTML}function ua(e){var t="other";return 2===e?t="widgetMessage":1===e&&(t="proactiveOffer"),t}function la(e,t){return function(n){return!e._disabled&&n&&n.status?t(n):n&&!n.status?n:Zr}}function da(e,t){var n=e.wmState,i=$n("#concierge-widgets ul"),r=i.children("li");if(!(r.length<=1)){var a=t?1:-1;r.sort((function(e,t){var i=e.getAttribute("data-spot"),r=t.getAttribute("data-spot"),o=mr(n,i).widget.sortKey,s=mr(n,r).widget.sortKey;return o>s?1*a:on&&!i&&!r)throw new Error("queue wait time is too long");return!0}function ha(e,t){var n=e.getDataClone("profileJSON"),i=n.session.visits.length-1,r=n.session.visits[i].journey.length-1;n.session.visits[i].journey[r].engagements||(n.session.visits[i].journey[r].engagements=[]),n.session.visits[i].journey[r].engagements.push(t),e.setData("profileJSON",JSON.stringify(n))}function fa(e,t,n){for(var i=e.getData("profileJSON"),r=i.session.visits[i.session.visits.length-1].journey,a=r.length-1,o=JSON.stringify(n),s=a;s>=0;s--){var c=r[s].engagements;if(c)for(var u=c.length-1;u>=0;u--){var l=c[u];if(l.id===t){if(JSON.stringify(l)===o)return L.resolve();if(n.dirty=!0,s===a)c[u]=n;else{c.splice(u,1),0===c.length&&delete r[s].engagements;var d=r[a];d.engagements?d.engagements.push(n):d.engagements=[n]}return e.setData("profileJSON",JSON.stringify(i))}}}return L.resolve()}function pa(e,t){for(var n=e.getDataObject("profileJSON"),i=n.session.visits.length-1,r=0;rd?g.value:(g={timeout:d+5e3,value:l.checkAvailability(o).then(i,r)},n[c]=g,g.value)}))},this.customData=function(t){return e.ready.then((function(){var n=e.cacheManager,i=n.getDataClone("profileJSON");if(void 0===i)throw new Error("Could not find visitor profile.");if(void 0===t)return i.customData;if(!JSON.stringify(t))throw new Error("Could not stringify customData");return i.customData=t,n.setData("profileJSON",JSON.stringify(i)).then((function(){return t}))}))},this.channelsData=function(t){return e.ready.then((function(){var n=e.cacheManager;return void 0===t?n.getVolatileData("moxie_channels_custom_data"):n.setVolatileData("moxie_channels_custom_data",t)}))},this.channelsFormData=function(t){return e.ready.then((function(){var n=e.cacheManager;return void 0===t?n.getVolatileData("moxie_channels_form_data"):n.setVolatileData("moxie_channels_form_data",t)}))},this.onQuestionnaireLoaded=function(t){e.onQuestionnaireLoadedCallbacks.add(t)},this.onQuestionnaireSubmit=function(t){e.onQuestionnaireSubmitCallbacks.add(t)}}function wa(){function e(e){return e.status}function t(e){return xe.log("checkAvailability error thrown: "+e.message),"false"}this.broadcast=wa.broadcast,this.transactionComplete=function(e,t){var n,i,r;return n=e.cacheManager,(r=n.getDataClone("profileJSON")).last_updated=Date.now(),r.session.transaction_completed=!0,void 0!==t&&(r=Qn(r,t,e)),i=Fe(Ve(r,1),1),e.contextMonitor.stop(),n.setData("profileJSON",JSON.stringify(r),!0).then((function(){return wa.broadcast("transactionCompleted",{transactionTotal:r.session.end_cart_value,cart:{value:i.current_cart_value,items:i.current_cart_items}}),ue(e,r.session.end_cart_value),Oe(e,"transactionComplete"),e.contextMonitor.initTracking().then((function(){e.contextMonitor.start()}))}))},this.updateSession=function(e,t){var n,i;t=t||{},i=Qn((n=e.cacheManager).getDataClone("profileJSON"),t,e),n.setData("profileJSON",JSON.stringify(i))},this.startEngagement=function(e,t){var n,i,r={};if(i=e.widgetManager,t&&"string"==typeof t.widget){if(Yn(t.widget))throw new Error("The engagement type is not allowed: "+t.widget);if(i.engagementWidgets.widgets[t.widget]){if(i.isValidEngagementConfig(t)){for(n in Be(t,"enableChatDeflection")&&!0===t.enableChatDeflection&&(t.widget="kbot"),t)Be(t,n)&&(r[n]=t[n]);var a,o={name:t.ruleName,source:"externalAPI",id:-2,action:"success"};return r.rule=o,a=i.addWidget(t,o).then((function(e){!1!==i.openWidget&&i.openWidget!==t.widget&&i.hideWidget(!0),Lr(i.wmState),i.showWidget(e.ref),i.showConcierge(),i.widgetsType.openConcierge()})),Oe(e,"startEngagement"),a}xe.log("GoMoxie.concierge.startEngagement: invalid widget configuration")}else xe.log('GoMoxie.concierge.startEngagement: invalid value for configuration parameter "widget"')}else xe.log("GoMoxie.concierge.startEngagement: missing required configuration parameter")},this.closeNotification=function(e,t){var n=e.widgetManager;return Oe(e,"closeNotification"),t?Lr(n.wmState):Wr(n.wmState)},this.startTrackingEngagement=function(e,t){new va(e,t).startEngagement(),Oe(e,"startTrackingEngagement")},this.updatePage=function(e,t,n){var i;return e.ready.catch((function(){return!1})).then((function(){return e.eventService.stub||(i=e.eventService),e.rulesEngine.removeAllEventListeners(),e.contextMonitor.stop(),e.cacheManager.cleanup(),e.widgetManager.destroy(),null})).then((function(){return Oe(e,"updatePage"),e.init(t,n,{eventService:i})}))},this.checkAvailability=function(n,i,r,a){var o,s,c,u,l,d,g,h,f,p,v;if(o={parameters:r},s=n.cacheManager,c=n.widgetManager,h=r.portalId,u="availability",l="availability-timestamp","chat"===i){if(void 0===h){if(void 0===(g=c.engagementWidgets.widgets.chat.portalId))return void xe.log("No Moxie portal/mailbox ID specified for engagement.");h=g,o.parameters.portalId=h}o.ruleSettings=n.rulesEngine.getSiteSettings(),u+="|"+h+"|"+c.device,l+="|"+h+"|"+c.device}return d=c.engagementWidgets.widgets[i],p=1e5,(f=s.getWidgetCache(i,l,!1))&&(p=(Date.now()-f)/1e3),v=f&&p<=5&&s.getWidgetCache(i,u,!1)?L.resolve(s.getWidgetCache(u)):d.checkAvailability(o).then(e,t).then((function(e){return L.all([s.setWidgetCache(i,u,e,!1),s.setWidgetCache(i,l,Date.now(),!1)]).then((function(){return e}))})),Oe(n,"checkAvailability"),v.then((function(e){return a(e),e}))},this.customData=function(e,t){var n,i;return i=(n=e.cacheManager).getDataClone("profileJSON"),void 0===t?void 0!==i?i.customData:void 0:JSON.stringify(t)?(i.customData=t,n.setData("profileJSON",JSON.stringify(i)),!0):(Oe(e,"customData"),!1)},this.channelsData=function(e,t){var n=e.cacheManager;if(void 0===t)return n.getVolatileData("moxie_channels_custom_data");try{n.setVolatileData("moxie_channels_custom_data",t)}catch(e){return xe.log("channelsData: "+e),!1}return Oe(e,"channelsData"),!0},this.channelsFormData=function(e,t){var n=e.cacheManager;if(void 0===t)return n.getVolatileData("moxie_channels_form_data");try{n.setVolatileData("moxie_channels_form_data",t)}catch(e){return xe.log("Error: "+e),!1}return Oe(e,"channelsFormData"),!0},this.onQuestionnaireLoaded=function(e,t){e.onQuestionnaireLoadedCallbacks.add(t)},this.onQuestionnaireSubmit=function(e,t){e.onQuestionnaireSubmitCallbacks.add(t)},this.registerMethods=function(e,t){void 0!==t&&void 0!==t.concierge&&(t.concierge.updateSession=this.updateSession.bind(void 0,e),t.concierge.transactionComplete=this.transactionComplete.bind(void 0,e),t.concierge.startEngagement=this.startEngagement.bind(void 0,e),t.concierge.checkAvailability=this.checkAvailability.bind(void 0,e),t.concierge.customData=this.customData.bind(void 0,e),t.concierge.closeNotification=this.closeNotification.bind(void 0,e),t.concierge.channelsData=this.channelsData.bind(void 0,e),t.concierge.channelsFormData=this.channelsFormData.bind(void 0,e),t.concierge.startTrackingEngagement=this.startTrackingEngagement.bind(void 0,e),t.concierge.onQuestionnaireLoaded=this.onQuestionnaireLoaded.bind(void 0,e),t.concierge.onQuestionnaireSubmit=this.onQuestionnaireSubmit.bind(void 0,e),t.concierge.updatePage=this.updatePage.bind(void 0,e),e.isTestMode&&(t.concierge.root=e))}}function ya(e){return e.signature="moxie_concierge",e}va.prototype.startEngagement=function(){if(!this.isValid)return xe.log("GoMoxie.concierge.startTrackingEngagement: unable to start engagement that had an invalid configuration"),!1;var e=function(e){var t={chat:null,decision_type:"",email:null,id:ui(),kb:null,name:e.engagementType,proactive:!1,rule:{name:e.ruleName,source:"externalAPI",id:-2,ruleAction:"success"},time:Date.now(),type:2};for(var n in e)"engagementType"!==n&&"ruleName"!==n&&Be(e,n)&&(t[n]=e[n]);return t}(this.config);return ha(this.concierge.cacheManager,e),!0},va.prototype.validateParams=function(e){var t,n;for(t in n=!0,"object"==typeof e&&e.engagementType&&e.ruleName||(xe.log("GoMoxie.concierge.TrackingEngagement.validateParams: missing required configuration parameter"),n=!1),e)Be(e,t)&&"string"!=typeof e[t]&&(xe.log("GoMoxie.concierge.TrackingEngagement.validateParams: invalid engagement parameter: "+t),n=!1);return n},ma.broadcast=Xn,wa.broadcast=Xn;var ba=[" ","\n","\t"];function Sa(){this.outputRaw=[],this.outputSub=[],this.currentSub=null,this.state=1,this.compiled=[],this.actions=[]}function Ca(e){var t=new Sa;return t.compile(e),function(e){return t.evaluate(e)}}Sa.prototype.compile=function(e){var t,n;for(t=0;t!==e.length;t++)switch(n=e[t],this.state){case 1:this.handleStateInput(n);break;case 2:this.handleStateOpen(n);break;case 4:this.handleStateSubOperator(n);break;case 3:this.handleStateSubInit(n);break;case 5:this.handleStateSub(n);break;case 6:this.handleStateSubFinal(n);break;case 7:this.handleStateClose(n)}var i=[],r=null;for(t=0;t!==this.outputRaw.length;t++)null===(n=this.outputRaw[t])?null!==r&&(i.push([r,t]),r=null):null===r&&(r=t);null!==r&&i.push([r,this.outputRaw.length]),this.outputSub.reduce((function(e,t){return null!==t&&e.push(t),e}),[]);var a=0;for(t=0;t!==i.length;t++){r=i[t][0];for(var o=i[t][1];a!==r;a++)this.actions.push(2),this.compiled.push(this.outputSub[a]);this.compiled.push(this.outputRaw.slice(r,o).join("")),a=o,this.actions.push(1)}this.outputRaw=null,this.outputSub=null},Sa.prototype.evaluate=function(e){for(var t,n=[],i=0;i!==this.actions.length;i++){switch(this.actions[i]){case 1:n.push(this.compiled[i]);break;case 2:null!=(t=e[this.compiled[i]])&&n.push(t)}}return n.join("")},Sa.prototype.handleStateInput=function(e){"<"===e?this.state=2:(this.outputRaw.push(e),this.outputSub.push(null))},Sa.prototype.handleStateOpen=function(e){"%"===e?this.state=4:(this.outputRaw.push("<"),this.outputRaw.push(e),this.outputSub.push(null),this.outputSub.push(null),this.state=1)},Sa.prototype.handleStateSubOperator=function(e){if("="!==e)throw new Error("Operator for the template must be '=', not '"+e+"'");this.state=3},Sa.prototype.handleStateSubInit=function(e){-1===ba.indexOf(e)&&(this.currentSub=[e],this.state=5)},Sa.prototype.handleStateSub=function(e){if(-1===ba.indexOf(e))return"%"===e?(this.finishSub(),void(this.state=7)):void this.currentSub.push(e);this.finishSub(),this.state=6},Sa.prototype.finishSub=function(){this.outputSub.push(this.currentSub.join("")),this.outputRaw.push(null),this.currentSub=null},Sa.prototype.handleStateSubFinal=function(e){if(-1===ba.indexOf(e)){if("%"!==e)throw new Error("Stray character '"+e+"' after substitution");this.state=7}},Sa.prototype.handleStateClose=function(e){if(">"!==e)throw new Error("Invalid sequence '"+e+"' after closing percent sign");this.state=1};var _a=function(e){e.$notifAnimate&&(e.$notifAnimate.stop(!0,!0),delete e.$notifAnimate),e.$areaAnimate&&(e.$areaAnimate.stop(!0,!0),delete e.$areaAnimate)},Ea=function(e){return 0===e.tabStyle.cascade},Ia=function(e,t){var n=t.index();if(n<0)return 0;Ea(e)||(n=t.parent().children("li").length-(n+1));return n+1};function Oa(e,t,n,i,r){return void 0===r&&(r="animate__"),new L((function(a){var o=""+r+t,s=document.querySelector(e),c=document.getElementById("concierge");s.classList.add(r+"animated",o),s.addEventListener("animationend",(function(e){e.stopPropagation(),s.classList.remove(r+"animated",o),function(e,t,n){e&&(n.classList.remove("con-closed"),n.classList.add("con-open")),t&&(n.classList.remove("con-open"),n.classList.add("con-closed"))}(n,i,c),a("Animation ended")}),{once:!0})}))}var xa=function(e){var t=e.widgetsType.getNotification();if(Ea(e)?Oa("#concierge-widgets-ul","fadeInDown",!0,!1):Oa("#concierge-widgets-ul","fadeInUp",!0,!1),Cr(e.wmState)){var n={},i=aa(e.wmState.notification.spot),r=65*Ia(e,i);1===i.length&&(n[Ea(e)?"top":"bottom"]=r),t.animate(n,{label:"desktopNotificationSlideOpen",done:function(){delete self.$notifAnimate}}),self.$notifAnimate=t}},Na=function(e){var t=e.widgetsType.getNotification();if(Ea(e)?Oa("#concierge-widgets-ul","fadeOutUp",!1,!0):Oa("#concierge-widgets-ul","fadeOutDown",!1,!0),e.widgetsType.notificationDisplayed){_a(self);var n={};n[Ea(e)?"top":"bottom"]=0,t.animate(n,{label:"desktopNotificationSlideClosed"})}},Ta=function(e,t,n){var i=t.find(".con-notch"),r={},a=Ia(e,n);return r[Ea(e)?"top":"bottom"]=function(e,t){return ia(e)?13:65*t+13}(e,a),"tab-widgets-content"===e.state?(i.animate(r,{label:"adjustNotch"}),!1):(i.css(r),!0)},ka=function(e){var t=e.$concierge;e.engagementWidgets.globalSettings.hideMoxieBranding&&t.addClass("hide-moxie")},Da=function(e,t){var n=e.$concierge.find("#concierge-widget-area");if(Ta(e,n,t)){n.hasClass("con-animating")?n.stop():n.css({opacity:0,right:50,display:"inline-block"}),ka(e);var i={opacity:1};void 0!==e.widgetAreaDragData.x&&void 0!==e.widgetAreaDragData.y?(n.addClass("free-floating"),i.left=e.widgetAreaDragData.x,i.top=e.widgetAreaDragData.y):i.right=75,n.addClass("con-animating").addClass("con-open").animate(i,{label:"desktopOpenArea",done:function(t,i){delete e.widgetsType.$areaAnimate,function(e,t){for(var n in t)Ut(e,t[n])}(n[0],["display","opacity","right"]),n.removeClass("con-animating"),i||"object"!=typeof window.visualViewport||e.widgetsType.applyKeyboardOffset(),e.widgetAreaDragData&&e.widgetAreaDragData.draggedByUser&&e.widgetAreaDragData.resizedWhileMinimized&&e.dragFixAfterResize()}})}e.state="tab-widgets-content",e.widgetsType.$areaAnimate=n},Ma=function(e,t){"object"==typeof window.visualViewport&&e.widgetsType.resetKeyboardOffset();var n=e.$concierge.find("#concierge-widget-area");"tab-widgets-content"===e.state&&(n.hasClass("con-animating")?n.stop():n.css({opacity:1,right:75,display:"block"}),t.css({display:"block"}),n.addClass("con-animating").removeClass("con-open").animate({opacity:0,right:50,display:"none"},{label:"desktopCloseArea",done:function(){delete e.widgetsType.$areaAnimate,n.removeAttr("style"),n.removeClass("con-animating"),t.removeAttr("style")}}),e.state="tab-widgets",e.widgetsType.$areaAnimate=n)},Aa=function(e){e.$concierge.find("#concierge-widgets");var t=e.$concierge.find("#concierge-tab");"tab"!==e.state||e.$concierge.hasClass("with-widgets")?"tab-widgets-content"===e.state?(e.$concierge.find("#concierge-widget-area").removeClass("con-open"),t.removeClass("con-pressed"),t.attr("aria-expanded","false"),e.$concierge.removeClass("with-widgets"),Wa(e),e.state="tab",Na(e),e.$concierge.addClass("con-closed")):(t.removeClass("con-pressed"),t.attr("aria-expanded","false"),e.$concierge.removeClass("with-widgets"),e.state="tab",Na(e),e.$concierge.addClass("con-closed")):(e.$concierge.addClass("with-widgets").removeClass("con-closed"),t.addClass("con-pressed"),t.attr("aria-expanded","true"),e.state="tab-widgets",xa(e))};function La(e){e.$concierge.find("#concierge-widgets");var t=e.$concierge.find("#concierge-tab");e.$concierge.addClass("with-widgets").removeClass("con-closed"),t.addClass("con-pressed"),t.attr("aria-expanded","true"),e.state="tab-widgets",document.getElementById("concierge").classList.contains("with-widgets")||xa(e)}var Wa=function(e){var t=e.$concierge.find("#concierge-widgets li.con-active");t.removeClass("con-active").removeClass("con-pressed"),t.find(".con-notch").remove(),t.find(".con-icon").attr("aria-expanded","false");var n=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active"),i=L.resolve(null);return e.openWidget&&(i=i.then((function(){return e.hideWidget(!1)}))),i.then((function(){return Ma(e,n)}))},Ra=function(e,t){var n=t.parameters,i=t.engagementId,r=aa(t.spot);if(r.hasClass("con-active"))return e.openWidget&&e.openWidget!==t.name?e.hideWidget(!1):L.resolve(null);r.addClass("con-active").addClass("con-pressed"),r.find(".con-icon").attr("aria-expanded","true");var a=n.rule.source;return i&&"offer"!==a&&"notification"!==a&&"button"!==a&&(n.rule.source="internal"),t.execute(e)},Pa=function(){var e=$n(this);e.addClass("con-pressed"),e.data("pressing",1),"concierge-tab"===e.attr("id")&&e.attr("aria-expanded","true"),e.find(".con-icon")&&e.find(".con-icon").attr("aria-expanded","true")},ja=function(){var e=$n(this);1===e.data("pressing")&&(e.data("pressing",0),e.removeClass("con-pressed"),e.find(".con-icon")&&e.find(".con-icon").attr("aria-expanded","false"),"concierge-tab"===e.attr("id")&&e.attr("aria-expanded","false"))},Fa=function(){return'
\n \n
    >
\n \n\n \n
\n'};function Va(e){this.html=Fa,this.cssType="desktop",this.notificationDisplayed=!1,this.visualViewportHasScroll=!1,this.visualViewportHasResize=!1;var t=this;this.start=function(){var n=e.$concierge.find("#concierge-tab"),a=e.$concierge.find("#concierge-widgets");n.on("mousedown",Pa),n.onPassive("touchstart",Pa),n.on("mouseleave",ja);var o=function(i){("click"===i.type||Ur(i.which))&&("click"===i.type&&n.removeClass("highlight"),$n(this).removeClass("con-pressed").data("pressing",0).attr("aria-expanded","false"),me(e.concierge,!1),Xn("bellClicked",{}),t.toggleWindow())};n.on("click",o),n.on("keypress",o),n.on("keyup",(function(e){$r(e.which)?$n(this).addClass("highlight"):zr(e.which)?i($n(this)):Kr(e.which)&&r($n(this))})),n.on("blur",(function(){$n(this).removeClass("highlight")})),cn(a,"mousedown",dn("li"),Pa),cn(a,"touchstart",dn("li"),Pa,!0),cn(a,"mouseleave",dn("li"),ja);var s=function(t){("click"===t.type||Ur(t.which))&&($n(this).removeClass("con-pressed").data("pressing",0),$n(this).find(".con-icon").attr("aria-expanded","false"),Zn((function(){return function(e,t){var n=$n(t.target).closest("li"),i=n.data("spot"),r=Or(e.wmState,i);if(r){if(r.buttonEnabled){var a=r.name,o=na(a),s=r.parameters;return n.removeClass("highlight"),(s=s||{}).rule=s.rule||{},s.rule.source="button",Zn((function(){return n.hasClass("con-active")?e.hideWidget(!1):Ra(e,r)})).then((function(){return me(e.concierge,!0,a),Xn("buttonClicked",{buttonName:o}),null}))}}else xe.log("DesktopWidgets: widgetsClicked: could not find widget for spot, "+i)}(e,t)})).catch((function(e){xe.log((e.stack,e.stack))})))};cn(a,"click",dn("li"),s),cn(a,"keypress",dn("li"),s);var c=function(n){if("click"===n.type||Ur(n.which)||Gr(n.which)){var i=$n(n.target);if(i.hasClass("con-x")||i.closest(".con-x").length>0)Lr(e.wmState);else{var r=e.wmState.notification;Ar(e.wmState),r&&r.shouldDisplayBell()&&e.$concierge.hasClass("con-closed")&&(t.toggleWindow(),e.state="tab-widgets")}}};e.$concierge.find("#con-notification").on("click",c).on("keypress",c)},this.toggleWindow=function(){Aa.call(this,e)},this.openWidgetMenu=function(){La.call(this,e)},this.focusWidgetButton=function(t){e.$concierge.find("#concierge-widgets li[data-widget="+t+"] .con-icon").focus()};function n(e,t,n){if(Cr(e.wmState)){n=n||{};var i=0,r=e.wmState.notification,a=aa(r.spot);a.length>0&&!ia(e)&&e.$concierge.hasClass("with-widgets")&&(i=65*Ia(e,a)),n[Ea(e)?"top":"bottom"]=i,t.css(n);var o=!0;if(r.spot){var s=mr(e.wmState,r.spot);s.widget&&s.widget.preferredSpotName()===r.preferredSpotName()&&(o=!1)}o?function(e){e.addClass("free-floating")}(t):function(e){e.removeClass("free-floating")}(t)}}this.makeWidgetActive=function(e){e.addClass("con-active")},this.makeWidgetInactive=function(e){e.removeClass("con-active")},this.openWidget=function(t){var n=t.name,i=e.$concierge.find("#concierge-widget-area");!function(e,t){var n={kb:"K B Engagement Widget",chat:"Live Chat",kbot:"Live Chat",email:"Email Engagement Widget","cxone-expert":"CXone Expert Widget"}[e]||"";t.attr("aria-label",n)}(n,i);var r=e.widgetAreaForWidget(n),a=i.children(".concierge-widget.con-active").not(r);function o(){$n(this).removeAttr("style")}this.makeWidgetInactive(a),this.makeWidgetActive(r),e.$concierge.find("#concierge-widgets li.con-active").removeClass("con-active").removeClass("con-pressed"),e.$concierge.find("#concierge-widgets li.con-active .con-icon").attr("aria-expanded","false"),"Tablet"===e.device&&r.find("iframe.widget-content").css({overflow:"auto"});var s=e.$concierge.find("#concierge-widgets li[data-widget="+n+"]");s.addClass("con-active").addClass("con-pressed"),s.find(".con-icon").attr("aria-expanded","true"),"tab-widgets-content"===e.state&&a.length>0&&(xe.log("openWidget(): invoked and willHide sent to already opened widget -"+a.data("widget")),ka(e),e.postMessageToWidget(a.data("widget"),"willHide"),r.css({opacity:.3}).animate({opacity:1},{label:"desktopOpenWidget",done:o}),a.css({display:"block",position:"absolute",top:2,height:"calc(100% - 4px)",width:"100%","padding-right":"4px",opacity:1,"z-index":100}).animate({opacity:0},{label:"desktopCloseWidget",done:o})),Da(e,s)},this.closeWidgets=function(){e.$concierge.find("#concierge-widgets li.con-active").removeClass("con-active").removeClass("con-pressed"),e.$concierge.find("#concierge-widgets li.con-active .con-icon").attr("aria-expanded","false");var t=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active");this.makeWidgetInactive(t),t.removeAttr("style"),Ma(e,t),e.$concierge.find("#concierge-widget-area").removeClass("con-open"),e.state="tab"},this.getNotification=function(){return e.$concierge.find("#con-notification")},this.getNotificationBody=function(){return e.$concierge.find("#con-notification-body")},this.getNotificationTitle=function(){return e.$concierge.find("#con-notification-title")},this.setAriaHidden=function(e){this.getNotificationBody().attr("aria-hidden",e),this.getNotificationTitle().attr("aria-hidden",e)},this.canDisplayNotification=function(){return!this.notificationDisplayed&&!e.$concierge.hasClass("con-open-widget")},this.maybeHandleOffset=function(){var t;0===e.tabStyle.verticalAnchor?t=window.visualViewport.offsetTop:(t=0,it()&&(t=window.visualViewport.height-tt()+window.visualViewport.offsetTop,t=Math.min(t,0))),this.conciergePrevOffset!==t&&(this.conciergePrevOffset=t,this.conElem.style.transform="translateY("+t+"px) scale("+1/window.visualViewport.scale+")",e.dragResizeHandler())},this.viewportHandler=function(e){this.conElem&&this.maybeHandleOffset()},this.applyKeyboardOffset=function(){this.conElem=mt("concierge"),window.visualViewport&&(this.visualViewportHasScroll||(this.visualViewportHasScroll=!0,rn(window.visualViewport,"scroll",this.viewportHandler.bind(this))),this.visualViewportHasResize||(this.visualViewportHasResize=!0,rn(window.visualViewport,"resize",this.viewportHandler.bind(this))))},this.resetKeyboardOffset=function(){this.conElem=null,window.visualViewport&&(this.visualViewportHasScroll&&(this.visualViewportHasScroll=!1,on(window.visualViewport,"scroll",this.viewportHandler.bind(this))),this.visualViewportHasResize&&(this.visualViewportHasResize=!1,on(window.visualViewport,"resize",this.viewportHandler.bind(this))))},this.updateNotification=function(){var t=this.getNotification();n(e,t,{})},this.displayNotification=function(){var t=this;this.notificationDisplayed=!0;var i=this.getNotification();i.addClass("con-active").removeClass("con-inactive"),this.setAriaHidden("false"),i.removeAttr("style");n(e,i,{opacity:0}),i.animate({opacity:1},{label:"desktopShowNotification",done:function(e,n){delete t.$notifAnimate,n||"object"!=typeof window.visualViewport||t.applyKeyboardOffset()}}),t.$notifAnimate=i},this.closeNotification=function(){"object"==typeof window.visualViewport&&this.resetKeyboardOffset();var e=this;this.notificationDisplayed=!1;var t=this.getNotification();t&&(t.animate({opacity:0},{label:"desktopHideNotification",done:function(){delete e.$notifAnimate,t.addClass("con-inactive").removeClass("con-active").removeAttr("style"),e.setAriaHidden("true")}}),e.$notifAnimate=t)},this.openConcierge=function(t){"tab-widgets-content"!==e.state&&(e.state="tab-widgets");var n=e.$concierge.find("#concierge-widgets");e.$concierge.addClass("with-widgets").removeClass("con-closed");var i=e.$concierge.find("#concierge-tab");if(i.addClass("con-pressed"),i.attr("aria-expanded","true"),n.addClass("con-visible"),t)return Ra(e,t)};var i=function(t){if(!ia(e)){var n=null;1===(n="concierge-tab"===t.attr("id")?$n("#concierge-widgets-ul li").last():t.prev()).length?(n.find(".con-icon").focus(),n.addClass("highlight")):$n("#concierge-tab").focus().addClass("highlight")}},r=function(t){if(!ia(e)){var n=null;1===(n="concierge-tab"===t.attr("id")?$n("#concierge-widgets-ul li").first():t.next()).length?(n.find(".con-icon").focus(),n.addClass("highlight")):$n("#concierge-tab").focus().addClass("highlight")}};this.createWidgetElement=function(t){var n=ia(e)?"":' role="menuitem"',a=e.concierge.getTranslation(na(t.name),"title"),o="";t.buttonEnabled||(o="disabled");var s=$n('
  • "),c=s.find("svg");c.length>0&&oa(c[0]);var u=s.find(".con-icon");return u.on("keyup",(function(e){$r(e.which)?s.addClass("highlight"):zr(e.which)?i(s):Kr(e.which)&&r(s)})),u.on("blur",(function(){s.removeClass("highlight")})),s},this.updateWidgetElement=function(t){var n=aa(t.spot);if(n.length>0){n.attr("data-widget",t.name);var i=e.concierge.getTranslation(na(t.name),"title"),r=n.find("button");r.attr("aria-label",i),r.html(t.icon.svg);var a=n.find("svg");a.length>0&&oa(a[0])}},this.addWidget=function(t){xe.log("DesktopWidgets: addWidget:",t.name,t);var i=$n("#concierge-widgets ul"),r=this.createWidgetElement(t);return i.append(r[0]),da(e,Ea(e)),n(e,this.getNotification()),ia(e)&&e.$concierge.removeClass("con-closed"),r};var a=function(t){var n={right:e.tabStyle.horizontalOffset,bottom:""},i=window.pageYOffset;0===e.tabStyle.verticalAnchor?n.top=e.tabStyle.verticalOffset+i:n.top=i+tt()-(e.tabStyle.verticalOffset+50),t.css(n)},o=function(t){var n={right:e.tabStyle.horizontalOffset};0===e.tabStyle.verticalAnchor?n.top=e.tabStyle.verticalOffset:n.bottom=e.tabStyle.verticalOffset,t.css(n)};this.fixPosition=function(e,t){"javascript"===e?(t.addClass("position-method-javascript"),xe.log("Concierge Client: PositionMethod - Javascript"),this.scrollHandler||(this.scrollHandler=function(){a(t)},rn(window,"scroll",this.scrollHandler)),a(t)):o(t)},this.beforeAppend=function(t){var n=[],i={right:e.tabStyle.horizontalOffset};o(t),Ea(e)?n.push("con-top"):n.push("con-bottom"),t.addClass(n.join(" ")),t.css(i)},this.destroy=function(){_a(this),this.scrollHandler&&on(window,"scroll",this.scrollHandler),$n("#concierge-style-desktop").remove(),this.resetKeyboardOffset()}}function qa(e){this.html=function(){return'
    \n
    \n \n
    \n
      >
    \n
    \n
    \n
    \n \n\n \n
    \n'},this.cssType="mobile",this.openWidgetCount=0,this.bodyOrigStyle="",this.bodyOrigClasses="",this.htmlOrigStyle="",this.htmlOrigClasses="",this.start=function(){var t=this;navigator.userAgent.match(/instagram/i)&&navigator.userAgent.match(/iphone/i)&&(e.$concierge.addClass("instagram"),e.$concierge.find("#concierge-widget-area").css("height",window.innerHeight+"px")),e.$concierge.find("#concierge-tab").onPassive("touchstart",(function(){$n(this).addClass("con-pressed").attr("aria-expanded","true"),function(e){var t=e.$concierge.find("#concierge-widgets");if(Ha(e,t),ia(e)){var n=mr(e.wmState,"single").widget;xe.log("widget "+n.name+" clicked");var i=na(n.name);me(e.concierge,!0,n.name),Xn("buttonClicked",{buttonName:i}),n.parameters.rule.source="button",n.execute(e)}else!function(e){e.$concierge.hasClass("con-open")||!e.shouldDisplayBell?Ba(e):function(e){var t=e.$concierge.find("#concierge-widgets");e.$concierge.find("#concierge-tab").attr("aria-expanded","true"),Ha(e,t),t.data("animation","opening"),e.$concierge.removeClass("con-pressed").removeClass("con-closed");var n=t.attr("style");t.removeAttr("style");var i=t.height();void 0===n||!1===n?t.css({overflow:"hidden",opacity:0,height:0}):t.attr("style",n);t.animate({height:i,opacity:1},{label:"mobileOpenMenu",done:function(){t.data("animation",!1),t.removeAttr("style"),e.$concierge.addClass("con-open")}})}(e)}(e)}(e)})).on("touchend",(function(){$n(this).removeClass("con-pressed")})),e.$concierge.onPassive("touchstart",".con-widgets li",(function(){$n(this).addClass("con-pressed"),$n(this).find(".con-icon").attr("aria-expanded","true")})).on("touchend",".con-widgets li",(function(){var t=$n(this);t.removeClass("con-pressed"),t.find(".con-icon");var n=t.data("spot"),i=Or(e.wmState,n);if(i){var r=i.name;return i.parameters.rule.source="button",xe.log("widget "+r+" clicked"),i.execute(e).then((function(){return me(e.concierge,!0,r),Xn("buttonClicked",{buttonName:na(r)}),!1}))}xe.log("MobileWidgets: widgetsClicked: could not find widget for spot, "+n)})),e.$concierge.find("#concierge-backdrop").on("click",(function(){Wr(e.wmState),Ba(e)}));var n=function(t){if("click"===t.type||Ur(t.which)||Gr(t.which)){var n=$n(t.target);n.hasClass("con-x")||n.closest(".con-x").length>0?Lr(e.wmState):Ar(e.wmState)}};e.$concierge.find("#con-notification").on("click",n),e.$concierge.find("#con-notification").on("keypress",n);var i=!1;this.orientationListener=function(){if(t.notificationDisplayed){var e=t.getNotification();i&&clearTimeout(i),i=setTimeout((function(){i=!1,e.css({width:nt()})}),500)}},window.addEventListener("orientationchange",this.orientationListener)},this.focusWidgetButton=function(t){ia(e)?e.$concierge.find("#concierge-tab").focus():e.$concierge.find("#concierge-widgets li[data-widget="+t+"]").focus()};this.addScrollFix=function(){var e=$n("html");this.htmlOrigStyle=e.attr("style"),this.htmlOrigClasses=e.attr("class"),e.attr("style",""),e.attr("class",""),e.addClass("concierge-modal-displayed");var t=$n("body");this.bodyOrigStyle=t.attr("style"),this.bodyOrigClasses=t.attr("class"),t.attr("style",""),t.attr("class",""),t.addClass("concierge-modal-displayed"),this.scrollFixApplied=!0},this.removeScrollFix=function(){if(this.scrollFixApplied){var e=$n("html");e.removeClass("concierge-modal-displayed"),e.attr("style",this.htmlOrigStyle),delete this.htmlOrigStyle,e.attr("class",this.htmlOrigClasses),delete this.htmlOrigClasses;var t=$n("body");t.removeClass("concierge-modal-displayed"),t.attr("style",this.bodyOrigStyle),delete this.bodyStyleRemoved,t.attr("class",this.bodyOrigClasses),delete this.bodyOrigClasses,$n("#concierge-widget-area").css({top:""}),delete this.scrollFixApplied}},this.makeWidgetActive=function(e){e.length>0&&(0===this.openWidgetCount&&this.addScrollFix(),e.addClass("con-active"),this.openWidgetCount+=e.length)},this.makeWidgetInactive=function(e){e.length>0&&(e.removeClass("con-active"),this.openWidgetCount-=e.length,0===this.openWidgetCount&&this.removeScrollFix())};this.openWidget=function(t){var n=t.name;!function(e,t){var n={kb:"K B Engagement Widget",chat:"Live Chat",kbot:"Live Chat",email:"Email Engagement Widget","cxone-expert":"CXone Expert Widget"}[e]||"";t.attr("aria-label",n)}(n,e.$concierge.find("#concierge-widget-area"));var i=e.widgetAreaForWidget(n),r=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active").not(i),a=this;this.makeWidgetActive(i),this.$widgetAnimating=i,function(e){var t=e.$concierge;e.engagementWidgets.globalSettings.hideMoxieBranding&&t.addClass("hide-moxie")}(e),i.attr("aria-expanded","true"),i.css({"z-index":1,opacity:0}).animate({opacity:1},{label:"mobileOpenWidget",done:function(){delete a.$widgetAnimating,a.makeWidgetInactive(r),r.attr("aria-expanded","false"),i.removeAttr("style")}}),Ba(e)},this.closeWidgets=function(){var t=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active"),n=this;t.css({opacity:1}).animate({opacity:0},{label:"mobileCloseWidgets",done:function(){xe.log("close complete"),n.makeWidgetInactive(t),t.removeAttr("style").attr("aria-expanded","false")}})},this.getNotification=function(){return e.$concierge.find("#con-notification")},this.getNotificationBody=function(){return e.$concierge.find("#con-notification-body")},this.getNotificationTitle=function(){return e.$concierge.find("#con-notification-title")},this.setAriaHidden=function(e){this.getNotificationBody().attr("aria-hidden",e),this.getNotificationTitle().attr("aria-hidden",e)},this.canDisplayNotification=function(){return!this.notificationDisplayed&&!e.$concierge.hasClass("con-open-widget")},this.fixPosition=function(e,t){if("javascript"===e){t.addClass("position-method-javascript"),xe.log("Concierge Client: PositionMethod - Javascript");var n=function(){var e=tt();t.css({top:e})};window.addEventListener("scroll",n),n()}};var t=!1,n=this;this.fixNotificationsUsingVisualViewport=function(){var e=mt("con-notification");e&&(t=!1,e.style.transform="translateY("+window.visualViewport.offsetTop+"px) scale("+1/window.visualViewport.scale+")")},this.viewportHandler=function(){t||(t=!0,qn(n.fixNotificationsUsingVisualViewport,"mobileNotifScrollFix"))},this.applyNotificationKeyboardOffset=function(){window.visualViewport.addEventListener("scroll",this.viewportHandler),window.visualViewport.addEventListener("resize",this.viewportHandler),this.viewportHandler()},this.resetNotificationKeyboardOffset=function(){window.visualViewport.removeEventListener("scroll",this.viewportHandler),window.visualViewport.removeEventListener("resize",this.viewportHandler)},this.updateNotification=function(){},this.displayNotification=function(t){var n=this;this.notificationDisplayed=!0,xe.log("opening notification.");var i=this.getNotification();i.data("parameters",t.parameters),i.addClass("con-active").removeClass("con-inactive"),this.setAriaHidden("false");var r="0px";e.engagementWidgets.globalSettings.notificationMobileVerticalOffset&&(r=e.engagementWidgets.globalSettings.notificationMobileVerticalOffset.toString()+"px"),n.$notifAnimating=i,i.css({top:"-150px"}).animate({top:r},{label:"mobileShowNotification",done:function(){n.$notifAnimating=!1;var e=nt();i.css({width:e}),"object"==typeof window.visualViewport&&n.applyNotificationKeyboardOffset()}})},this.closeNotification=function(){"object"==typeof window.visualViewport&&this.resetNotificationKeyboardOffset();var e=this;this.notificationDisplayed=!1;var t=this.getNotification();t&&t.animate({opacity:0},{label:"mobileHideNotification",done:function(){t.addClass("con-inactive").removeClass("con-active").removeAttr("style"),e.setAriaHidden("true")}})},this.openConcierge=function(){},this.destroy=function(){this.$notifAnimating&&(this.$notifAnimating.stop(!0,!0),delete this.$notifAnimating),this.$widgetAnimating&&(this.$widgetAnimating.stop(!0,!0),delete this.$widgetAnimating),this.orientationListener&&(window.removeEventListener("orientationchange",this.orientationListener),delete this.orientationListener),this.removeScrollFix(),$n("#concierge-style-mobile").remove()},this.createWidgetElement=function(t){var n=ia(e)?"":' role="menuitem"',i=e.concierge.getTranslation(na(t.name),"title");return $n('
  • '+i+"
  • ")},this.updateWidgetElement=function(t){var n=aa(t.spot),i=n.find("button");if(ia(e)){var r=$n("#concierge-tab");i.pushAll(r),n.pushAll(r)}n.attr("data-widget",t.name),n.attr("data-spot",t.spot);var a=e.concierge.getTranslation(na(t.name),"title");n.find(".con-mobile-primary-menu").text(a),i.attr("aria-label",a),i.html(t.icon.svg);var o=i.find("svg");o.length>0&&oa(o[0])},this.addWidget=function(t){xe.log("MobileWidgets: addWidget:",t.name,t);var n=$n("#concierge-widgets ul"),i=this.createWidgetElement(t);if(n.append(i[0]),da(e,!0),ia(e)){var r=$n("#concierge-tab");return r.html(t.icon.svg),r.attr("data-widget",t.name),r.attr("data-spot",t.spot),r}return i}}function Ha(e,t){var n=t.data("animation");return n&&("opening"===n?(t.stop(),e.$concierge.addClass("con-open")):"closing"===n&&t.stop(),t.data("animation",!1)),n}function Ba(e){var t=e.$concierge.find("#concierge-widgets");(e.$concierge.find("#concierge-tab").attr("aria-expanded","false"),e.$concierge.hasClass("con-closed"))||"closing"!==t.data("animation")&&(Ha(e,t),t.data("animation","closing"),e.$concierge.removeClass("con-pressed").removeClass("con-open"),t.css({overflow:"hidden"}),t.animate({opacity:0,height:0},{label:"mobileCloseMenu",done:function(){t.data("animation",!1),t.removeAttr("style"),e.$concierge.addClass("con-closed")}}))}function Ja(){}Ja.prototype.markChat=function(e,t,n){var i=Date.now();return e.transient_data?(e.transient_data.vp_data.chat.session_id=Math.abs(parseInt(t)),"start"===n&&(e.transient_data.vp_data.chat.start_time=i),"end"===n&&(e.transient_data.vp_data.chat.end_time=i)):e.transient_data={vp_data:{chat:{session_id:t,start_time:i}}},xe.log("Marking chat "+t+" as "+n),e};var $a=function(e,t){hn(this,t),this.parameters=this.parameters||{},this.configuration=this.configuration||{},this.configuration.connectorUrl=e.serviceUrl.connector,function(e,t){var n=t.widgetManager;e.priority=1,e.state=0,e.buttonEnabled=!0,e.preferredSpotName=function(){return this.name},e.getSpotName=function(){return this.spot},e.label=function(){var e=V(this,"parameters","rule","name");return e?this.name+":"+e:this.name},e.checkAvailability=function(){return L.resolve({status:!0})},e.shouldDisplayBell=function(){return!0},e.beforeNotify=function(e){return L.resolve(Ua(e,!0))},e.beforeAdd=function(e){return L.resolve(Ua(e,!0))},e.beforeLoad=function(){},e.getRemoteURL=function(){if(this.remoteURL)return this.remoteURL},e.hideWidget=function(){n.wmState.open===this&&n.hideWidget(!1)},e.closeWidget=function(){if(this.spot){var e=mr(n.wmState,this.spot);this.hasFinished=!0,e.widget===this&&e.reactive&&e.reactive!==this&&Ir(n.wmState,e.reactive)}},e.destroy=function(e){},e.unload=function(){0!==this.state&&(n.widgetAreaForWidget(this.name).remove(),this.state=0)},e.execute=function(e){var t=this;return e.concierge.cacheManager.removeWidgetCache(this.name,"widget-closed").then((function(){e.showWidget(t)}))}}(this,e)};function Ua(e,t){return(e=e||{}).status=t,e}function Ga(e){var t;return e.getAllResponseHeaders().indexOf("x-trace-id")>=0&&(t=e.getResponseHeader("x-trace-id")),t}var za=function(e){function t(t,n){e.call(this,t,n),Za(this,t),function(e,t){var n=t.widgetManager,i=t.cacheManager;e.beforeAdd=function(e){var r,a,o=e.ref,s=e.parameters,c=Xa(n.device),u=o.name,l=o.getEngagmentId(),d=o.getSuspendedSession(),g=o.getActiveSession();if(!e.ruleSettings)throw new Error("obj.ruleSettings is missing");return a=e.ruleSettings.skip_chat_queue_status_check?t.serviceUrl.connector+"/connector/channels/portal_with_service_line/"+s.portalId+"/device/"+c:t.serviceUrl.connector+"/connector/channels/portals_with_queue_status/"+s.portalId+"/device/"+c,t.httpGetXMLHttpRequest(a).then((function(a){var c,h=JSON.parse(a.responseText);if(s.traceId=Ga(a),e.ruleSettings.skip_chat_queue_status_check)s.serviceLineId||(s.serviceLineId=h.response.serviceLineId,s.serviceLine=h.response.serviceLineName),t.serviceLines.setName(s.serviceLineId,s.serviceLine),c=h.response;else{if(s.serviceLineId||(s.serviceLineId=h.response.queueStatus.id,s.serviceLine=h.response.queueStatus.name),t.serviceLines.setName(s.serviceLineId,s.serviceLine),!h.response)throw new Error("status.response evaluates to false");var f=s.rule&&s.rule.source?s.rule.source:"internal";if(!Qr(f)&&e.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==h.response.queueStatus.queueopen)throw new Error("service line is closed");if(r="true"===h.response.queueStatus.slotavailable,!Qr(f)&&e.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&!r&&!d&&!g&&!e.engagementId)throw new Error("spot not available");ga(e.ruleSettings.check_queue_wait_time_for_on_demand_chat,V(h,"response","queueStatus","holdtime"),e.ruleSettings.queue_wait_time,d,g),c=h.response.portalData}s.widgetpath=t.scriptLocationWithBrand+"/widgets/chat/"+t.assetVersion.widgets+"/",s.langOptions=t.langOptions;var p=0;c.deviceList.length>1&&(p=Xa(n.device));var v="<%=host %>/netagent/cimlogin.aspx?questid=<%=questId %>&portid=<%=portalId %>&defaultStyleId=<%=styleId %>&widgetpath=<%=widgetpath %>&nareferer=<%=nareferer %>&flyout=1";v=Ca(v)({host:s.host,questId:c.deviceList[p].questid,styleId:c.deviceList[p].styleid,portalId:c.deviceList[p].styleid,widgetpath:t.scriptLocationWithBrand+"/widgets/chat/"+t.assetVersion.widgets+"/",nareferer:encodeURIComponent(window.location.href)}),("string"==typeof o.remoteURL||o.remoteURL instanceof String)&&(o.remoteURL={}),o.portalId=s.portalId,o.remoteURL[s.portalId]=v,o.oldRemoteUrl=v,navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?o.remoteURL[s.portalId]+="&fullScreen=false":"Mobile"!==n.device&&"Tablet"!==n.device||(o.remoteURL[s.portalId]+="&fullScreen=true"),e.engagementId&&e.engagementId!==l&&(l=!1);var m=0!==n.notificationType;return s.questId=c.deviceList[p].questid,s.styleId=c.deviceList[p].styleid,o.shouldReplaceIframeSrc=!0,d&&l?(m&&n.widgetsType.closeNotification(),i.removeWidgetCache(u,"suspended_session",!0),void(o.autoOpen=!0)):n.loadingActiveWidgets&&g&&l?(o.origRemoteURL=o.remoteURL,o.oldRemoteUrl=o.remoteURL[s.portalId],o.remoteURL[s.portalId]=Ca(g)({host:s.host,widgetpath:t.scriptLocationWithBrand+"/widgets/chat/"+t.assetVersion.widgets+"/"}),navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?o.remoteURL[s.portalId]+="&fullScreen=false":"Mobile"!==n.device&&"Tablet"!==n.device||(o.remoteURL[s.portalId]+="&fullScreen=true"),t.cacheManager.getWidgetCache(u,"widget-closed")||m?n.loadWidget(o):void(o.autoOpen=!0)):void 0})).then((function(){return e.status=!0,e}))},e.beforeNotify=function(i){var r=t.rulesEngine,a=Xa(n.device),o=60;r.queueWaitTime&&(o=r.queueWaitTime());var s=i.rule,c=null;s&&s.id?c=s.id:xe.log("Chat Widget:beforeNotify: rule id missing from obj:",i);var u=i.parameters,l=t.serviceUrl.connector+"/connector/channels/queue_status/"+u.portalId+"/device/"+a;return t.httpGetXMLHttpRequest(l).then((function(r){var a=JSON.parse(r.responseText);u.traceId=Ga(r);var s=a.response.id;if(u.serviceLineId=a.response.id,u.serviceLine=a.response.name,t.serviceLines.setName(u.serviceLineId,u.serviceLine),t.cacheManager.getWidgetCache(e.name,"suspended_session",!0))return i.status=!1,function(e,t){for(var n=e.getData("profileJSON"),i=n.session.visits.length-1,r=0;r=o?(d.chat.missed_reason=3,ve(t,"wait-too-long",s,c,"proactive",u.traceId)):"false"===a.response.agentavailable?(d.chat.missed_reason=1,ve(t,"no-agent-available",s,c,"proactive",u.traceId)):"true"!==a.response.slotavailable&&ve(t,"no-agent-slots-available",s,c,"proactive"),n.setEngagementRecord(i.engagementId,d),i.status=!1}return i}))},e.startNewSession=function(){var n=t.widgetManager,r=Xa(n.device),a=t.serviceUrl.connector+"/connector/channels/queue_status/"+e.parameters.portalId+"/device/"+r;return t.httpGet(a).then((function(r){if(e.shouldReplaceIframeSrc){var a=e.getRemoteURL();"true"!==r.response.slotavailable&&(a=Ya(i,e.oldRemoteUrl)),navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?a+="&fullScreen=false":"Mobile"!==n.device&&"Tablet"!==n.device||(a+="&fullScreen=true"),$n("#concierge-widget-chat .widget-content").attr("src",a)}else $n("#concierge-widget-chat iframe.widget-content").replaceWith(''),t.widgetManager.writeSrcToIframe(e.name)}))},e.checkAvailability=function(e){var i=e.parameters,r=Xa(n.device);if(!e.ruleSettings)return L.resolve({status:!1});var a=t.serviceUrl.connector+"/connector/channels/queue_status/"+i.portalId+"/device/"+r;return t.httpGet(a).then((function(t){return t.response?e.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==t.response.queueopen?{status:!1}:e.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&"true"!==t.response.slotavailable?{status:!1}:e.ruleSettings.check_queue_wait_time_for_on_demand_chat&&parseInt(t.response.holdtime,10)>e.ruleSettings.queue_wait_time?{status:!1}:{status:!0}:{status:!1}})).catch((function(e){return xe.log("checkAvailability error thrown: "+e),{status:!1}}))},e&&e.titleBar&&(e.titleBar.onclick=function(){n.hideWidget(!1),Xn("widgetMinimized",{widgetName:e.name})})}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a),Ka={};function Xa(e){var t=Ka[e];return t||(t=0),t}Ka.Mobile=1,Ka.Tablet=2,Ka.Desktop=3;var Qa=function(e){return parseInt(e)};function Ya(e,t){var n,i=e.getVolatileData("moxie_channels_custom_data");if(function(e,t){if(e)for(var n=t.split("&"),i=0;i0&&n.handleBroadcast(r,"chatSessionStarted",{sessionId:a})}},e.beforeLoad=function(){t.widgetManager.channelsWidget=this}}var eo=function(e){function t(t,n){e.call(this,t,n),this.baseHideWidget=this.hideWidget,this.hideWidget=function(){this.baseHideWidget(),this.closeWidget()}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a);function to(e,t,n,i,r,a,o,s){Object.defineProperty(this,"name",{value:t,enumerable:!0,writable:!1}),Object.defineProperty(this,"maxLength",{value:n,enumerable:!0,writable:!1}),Object.defineProperty(this,"required",{value:i,enumerable:!0,writable:!1}),Object.defineProperty(this,"label",{value:r,enumerable:!0,writable:!1}),Object.defineProperty(this,"type",{value:a,enumerable:!0,writable:!1}),Object.defineProperty(this,"defaultvalue",{value:o,enumerable:!0,writable:!1}),Object.defineProperty(this,"options",{value:s,enumerable:!0,writable:!1}),this.hide=e}function no(){this.hide=!1,this.questions=[]}to.prototype.setAnswer=function(e){var t=void 0!==e.hide?e.hide:this.hide;if("16"===this.type||"15"===this.type||"4"===this.type||"6"===this.type){for(var n=0;n1&&(o=Xa(n.device));(!s.remoteURL||"string"==typeof s.remoteURL||s.remoteURL instanceof String)&&(s.remoteURL={}),s.portalId=c.portalId,s.remoteURL[c.portalId]=Ca("<%=host %>/netagent/cimlogin.aspx?questid=<%=questId %>&portid=<%=portalId %>&defaultStyleId=<%=styleId %>&widgetpath=<%=widgetpath %>&flyout=1")({host:c.host,questId:a.response.deviceList[o].questid,styleId:a.response.deviceList[o].styleid,portalId:a.response.deviceList[o].styleid,widgetpath:t.scriptLocationWithBrand+"/widgets/kbot/"+t.assetVersion.widgets+"/"}),s.hashedQuestId=a.response.deviceList[o].questid,s.hashedPortalId=a.response.deviceList[o].styleid,navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?(c.fullScreen=!1,s.remoteURL[c.portalId]+="&fullScreen=false"):"Mobile"!==n.device&&"Tablet"!==n.device||(c.fullScreen=!0,s.remoteURL[c.portalId]+="&fullScreen=true"),r.engagementId&&r.engagementId!==l&&(l=!1);var u=0!==n.notificationType;if(c.questId=a.response.deviceList[o].questid,c.styleId=a.response.deviceList[o].styleid,i.getWidgetCache("kbot","suspended_session",!0)&&l)return u&&n.widgetsType.closeNotification(),e.shouldReplaceIframeSrc=!0,i.removeWidgetCache("kbot","suspended_session",!0),void(e.autoOpen=!0);var d=i.getWidgetCache("kbot","widget-closed");if(n.loadingActiveWidgets&&g&&l)return e.shouldReplaceIframeSrc=!0,s.origRemoteURL=s.remoteURL,s.oldRemoteUrl=s.remoteURL[c.portalId],s.remoteURL[c.portalId]=Ca(g)({host:c.host,widgetpath:t.scriptLocationWithBrand+"/widgets/kbot/"+t.assetVersion.widgets+"/"}),d||u?n.loadWidget(e):void(e.autoOpen=!0);if(n.loadingActiveWidgets&&h&&l){var f=i.getWidgetCache("kbot","shouldReopen",!1);return d||u||!f?n.loadWidget(e):void(e.autoOpen=!0)}})).then((function(){return r.status=!0,r}))},e.beforeNotify=function(e){return L.resolve(Ua(e,!1))},e.startNewSession=function(){var e=t.widgetManager.createEngagementRecord(this,"kb");i.setWidgetCache("kbot","engagement_id",e,!0),i.removeWidgetCache("kbot","active_session"),i.removeWidgetCache("kbot","surveyOpen"),$n("#concierge-widget-kbot iframe.widget-content").replaceWith(''),t.widgetManager.writeSrcToIframe("kbot"),delete this.shouldReplaceIframeSrc},e.createChatEngagementRecord=function(){var e=t.widgetManager.createEngagementRecord(this,"chat");return i.setWidgetCache("kbot","engagement_id",e,!0),{id:e,data:t.widgetManager.getEngagementRecord(e)}}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a);var ro=function(e){function t(t,n){e.call(this,t,n),function(e,t){e.beforeAdd=function(n){if(n.parameters.langOptions=t.langOptions,!n.ruleSettings)throw new Error("obj.ruleSettings is missing");return e.parameters.ruleSettings=n.ruleSettings,n.status=!0,L.resolve(n)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a);var ao=function(e){function t(t,n){e.call(this,t,n),function(e,t){e.preferredSpotName=function(){return"kb"},e.beforeAdd=function(n){if(n.parameters.langOptions=t.langOptions,!n.ruleSettings)throw new Error("obj.ruleSettings is missing");return e.parameters.ruleSettings=n.ruleSettings,n.status=!0,L.resolve(n)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a);var oo=function(e){function t(t,n){e.call(this,t,n),function(e,t){e.preferredSpotName=function(){return"chat"},e.icon={svg:t.widgetManager.engagementWidgets?t.widgetManager.engagementWidgets.widgets.chat.icon.svg:""},e.execute=function(t){var n=this;return e.setUpBrandEmbassyObserverThatAlsoRemovesHiddenClass(),e.showDFOWidget().then((function(){return t.showWidget(n)}))},e.beforeNotify=function(n){var i=t.cacheManager.getWidgetCache(e.name,"minimized",!0);return n.status=!0,"false"==i&&(n.status=!1),L.resolve(n)},e.determineDFOState=function(n){if("undefined"==typeof brandembassy)return e.addDFOToPage(n.parameters.brand_id,n.parameters.brand_hash,n.parameters.chat_file_url),n.status=!0,L.resolve(n);var i=t.cacheManager.getWidgetCache(e.name,"minimized",!0);return"false"!=i&&0!=i&&null!=i||(Hr(t.widgetManager.wmState,e),e.execute(t.widgetManager),n.parameters.proactive?n.status=!1:n.status=!0),L.resolve(n)},e.beforeAdd=function(n){return e.setUpListenerForActiveChatRecovery(),"undefined"!=typeof brandembassy&&brandembassy("hideChatWindow"),e.getChatStatus(n.parameters.base_chat_service_url,n.parameters.brand_id,n.parameters.brand_hash,t).then((function(i){if("online"==i)return e.determineDFOState(n);throw n.parameters.proactive&&ve(t,"service-line-closed",n.parameters.channel_id,n.parameters.rule.id,n.parameters.proactive),new Error("There are No Agents")}))},e.destroy=function(){e.clearActiveSessionPoll(),e.observer.disconnect(),e.initObserver.disconnect(),e.addHiddenObserver.disconnect(),window.removeEventListener("message",e.processEventFromDFO)},e.getChatStatus=function(e,t,n,i){return i.httpGet(e+"/chat/1.0/brand/"+t+"/channel/"+n).then((function(e){return e.availability.status})).catch((function(e){return xe.warn(e),"offline"}))},e.injectCSS=function(){var e=t.widgetManager.engagementWidgets.conciergeTab.tabStyle.tabColor;brandembassy("setCustomCss",'\n [data-selector="HEADER"] {background-color: '+e+' !important;}\n [data-selector="PRIMARY_BUTTON"][type="submit"] div {background-color: '+e+" !important;}")},e.showDFOWidget=function(){if(!t.widgetManager.isMobile()){var n=document.getElementById("concierge");n.classList.add("con-open"),n.classList.remove("con-closed");var i=document.getElementById("concierge-widget-area");i.classList.add("be-guide-frame"),i.removeAttribute("style"),i.classList.remove("free-floating")}return t.cacheManager.setWidgetCache(e.name,"minimized",!0,!1),t.widgetManager.showWidget(e).then((function(){})).then((function(){brandembassy("openChatWindow"),Hr(t.widgetManager.wmState,e),function(e){if(!t.widgetManager.isMobile()){var n=t.widgetManager.tabStyle.verticalOffset+"px",i=document.getElementById("be-frame");brandembassy("setOffsetX",77+t.widgetManager.tabStyle.horizontalOffset),e?(i.style.removeProperty("top"),n=t.widgetManager.tabStyle.verticalOffset+3+"px",i.style.bottom=n):(i.style.top=n,i.style.removeProperty("bottom"))}}(t.widgetManager.tabStyle.verticalAnchor)}))},e.handlePushUpdate=function(n){var i=n.data.case.id,r=e.parameters.channel_name,a=e.parameters.channel_id,o="closed"===n.data.case.status;switch(n.eventType){case"CaseCreated":re(t,!0,e.name,i,r,a),Hr(t.widgetManager.wmState,e),e.setupActiveSessionPolling();break;case"CaseInboxAssigneeChanged":o||(n.data.inboxAssignee&&ee(t,!0,e.name,n.data.inboxAssignee.id,n.data.inboxAssignee.firstName+" "+n.data.inboxAssignee.surname,i,r,a,a),n.data.previousInboxAssignee&&ee(t,!1,e.name,n.data.previousInboxAssignee.id,n.data.previousInboxAssignee.firstName+" "+n.data.previousInboxAssignee.surname,i,r,a,a));break;case"CaseStatusChanged":o&&(re(t,!1,e.name,i,r,a,a),Br(t.widgetManager.wmState,e),e.clearActiveSessionPoll())}},e.addDFOToPage=function(t,n,i){e.setUpBrandEmbassyObserver(),function(e,t,n,i,r,a,o,s){r=r,e.BrandEmbassy=i,e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},e[i].l=+new Date,o=t.createElement(n),s=t.getElementsByTagName(n)[0],o.async=1,o.src=r+"?"+Math.round(Date.now()/1e3/3600),s.parentNode.insertBefore(o,s)}(window,document,"script","brandembassy",i),brandembassy("init",parseInt(t),n),brandembassy("setAllowedExternalMessageTypes",["CHAT_SESSION_RECOVERED"]),brandembassy("onPushUpdate",so,(function(t){return e.handlePushUpdate(t)})),e.injectCSS()},e.setUpBrandEmbassyObserver=function(){e.addHiddenObserver=new MutationObserver((function(){null!=document.getElementById("be-chat-container")&&(document.getElementById("be-chat-container").classList.add("be-hidden"),e.addHiddenObserver.disconnect())})),e.addHiddenObserver.observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})},e.setUpBrandEmbassyObserverThatAlsoRemovesHiddenClass=function(){e.initObserver=new MutationObserver((function(){null!=document.getElementById("be-chat-container")&&(document.getElementById("be-chat-container").classList.remove("be-hidden"),document.getElementById("be-chat-container").classList.add("init"),e.addListenersForBEFrame(),e.initObserver.disconnect())})),e.initObserver.observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})},e.addListenersForBEFrame=function(){var n=document.getElementById("be-frame");n.classList.contains("be-frame-minimized")&&t.cacheManager.setWidgetCache("dfo-live","minimized",!0,!0),e.observer=new MutationObserver((function(){"be-frame-minimized"==n.className?e.multipleWidgetLogic():(t.cacheManager.setWidgetCache("dfo-live","minimized","false",!0),document.getElementById("be-chat-container").classList.add("init"))})),e.observer.observe(n,{attributes:!0,attributeFilter:["class"]})},e.multipleWidgetLogic=function(){var n=document.getElementById("concierge-widgets-ul").getElementsByTagName("li"),i=!0;(n.forEach((function(e){e.getAttribute("data-widget")!=F&&e.classList.contains("con-active")&&(i=!1)})),i)&&(document.getElementById("concierge-widget-area").classList.remove("be-guide-frame"),t.widgetManager.hideWidget(),t.cacheManager.setWidgetCache("dfo-live","minimized",!0,!0),brandembassy("hideChatWindow"),e.hasFinished=!0,null==brandembassy("getOngoingContact")&&Br(t.widgetManager.wmState,e))},e.processEventFromDFO=function(n){n.isTrusted&&"CHAT_SESSION_RECOVERED"==n.data.actionType&&n.origin==window.location.origin&&("OPEN"==n.data.action.session.status?e.execute(t.widgetManager).then((function(){e.pollActiveSession(1),e.setupActiveSessionPolling()})).catch((function(e){xe.warn(e)})):(t.cacheManager.setWidgetCache("dfo-live","minimized",!0,!0),Br(t.widgetManager.wmState,e)),window.removeEventListener("message",e.processEventFromDFO))},e.pollActiveSession=function(n){if("undefined"!=typeof brandembassy){var i=brandembassy("getOngoingContact");i?te(t,i.contact.id,n,e.name):e.clearActiveSessionPoll()}else e.clearActiveSessionPoll()},e.clearActiveSessionPoll=function(){e.activeSessionPolling&&(clearInterval(e.activeSessionPolling),delete e.activeSessionPolling)},e.setupActiveSessionPolling=function(){e.activeSessionPolling||(e.activeSessionPolling=setInterval((function(){e.pollActiveSession(2)}),6e4))},e.setUpListenerForActiveChatRecovery=function(){window.addEventListener("message",e.processEventFromDFO)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a),so=["CaseCreated","CaseInboxAssigneeChanged","CaseStatusChanged"];var co=function(e){function t(t,n){e.call(this,t,n),function(e,t){e.name="bell",e.priority=0,e.buttonEnabled=!1,e.icon=V(t,"widgetManager","engagementWidgets","conciergeTab","icon"),e.preferredSpotName=function(){return"bell"},e.execute=function(e){return L.resolve(null)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a);var uo=function(e){function t(t,n){e.call(this,t,n),this.engagement_type=5,function(e,t){var n=t.widgetManager;e.priority=0,e.shouldDisplayBell=function(){return!1},e.preferredSpotName=function(){return null},e.beforeAdd=function(e){if(ia(n)){var i=n.wmState;if(null===i.spots.single.widget)return Rr(i,new co(t,{rule:{source:"internal"},parameters:{}})).then((function(t){return Ua(e,t.status)}))}return L.resolve(Ua(e,!0))},e.execute=function(n){var i=this;if(!i.isExecuting){var r=this.parameters;return i.isExecuting=!0,"_blank"===r.linkStrategy?(lo(t,r),Vr(n.wmState,e),i._openTimeout=setTimeout((function(){i.isExecuting=!1,qr(n.wmState,e),delete i._openTimeout}),1e3),window.open(r.url,r.linkStrategy,"noopener")):t.logDisabled?window.open(r.url,r.linkStrategy,"noopener"):(window.addEventListener("GoMoxie:PriorityEvents",(function(){window.open(r.url,r.linkStrategy,"noopener")}),!1),Vr(n.wmState,e),this._openTimeout=setTimeout((function(){delete i._openTimeout,window.open(r.url,r.linkStrategy,"noopener")}),3e3),lo(t,r)),L.resolve(null)}},e.destroy=function(t){qr(t.wmState,e),this._openTimeout&&clearTimeout(this._openTimeout)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}($a);function lo(e,t){Xn("linkFollowed",{strategy:t.linkStrategy,url:t.url}),Ee(e,t.url,t.linkStrategy,t.rule.id)}function go(e){e.bridgeListener=ho.bind(e),window.addEventListener("message",e.bridgeListener,!1)}function ho(e,t){var n=po,i=!1;null!=t&&(n=t.doPostMessage,i=!0);var r=this;window.test_concierge&&(r=window.test_concierge.widgetManager);var a,o=r.concierge,s=o.cacheManager,c=r.wmState;if("string"==typeof e.data&&"SessionCleared"!==e.data)try{a=JSON.parse(e.data)}catch(t){return xe.log("WidgetBridge received invalid JSON: ",t),void xe.log("Payload was:"+e.data)}else e.data.messageType&&(e.data.type=e.data.messageType),a=e.data;if(a&&a.call&&r.channelsWidget)r.channelsWidget.handleChannelsMessage(a,e);else{var u=a.widget;if(u){var l=r.engagementWidgets.widgets[u];if(l){var d=l.parameters;if(function(e,t){var n=window.location.hostname,i=(e.cacheManager.getClientCache("channelsHosts",!0)||[]).map((function(e){return fo(e)})),r=fo(e.scriptLocation),a=fo(t.origin),o=[n,r].concat(i);if(!a||o.every((function(e){return a!==e}))){var s=['The domain "',document.domain,'" ','rejected message from un-trusted domain: "',a,'"'].join("");return e.isTestMode&&xe.log(s),!1}return!0}(o,e)){var g,h=e.data,f=e.data.parameters;if(xe.log("["+h.type+"] message accepted from: "+e.origin),!i&&"_multi"===h.type)return g=vo(r,u,e,h,f),void n(e,g);g={};var p=null,v=null;switch(h.type){case"focusEvent":"Tablet"===r.device&&"object"!=typeof window.visualViewport&&(r.makePositionAbsolute(),r.needsForceBlur=!0);break;case"getChatStore":null!=s.storagePlugin.get("MoxieChat",!0)?s.storagePlugin.get("MoxieChat",!0):s.storagePlugin.set("MoxieChat",{},!0),g={type:"getChatStoreResponse",replyForMsgId:h.msgId,parameters:{data:s.storagePlugin.get("MoxieChat",!0)}},n(e,g);break;case"blurEvent":"Tablet"===r.device&&"object"!=typeof window.visualViewport&&(r.needsForceBlur=!1);break;case"resetConcierge":sa(r,!0),r.removeWidget(l,!0),r.addWidget(l.parameters,l.parameters.rule);break;case"getVisitorProfile":p="profileJSON",g={type:"getVisitorProfileResponse",replyForMsgId:h.msgId,parameters:{data:s.getData(p)}},n(e,g);break;case"setVisitorProfile":p="profileJSON",s.setData(p,JSON.stringify(f.data));break;case"getEngagementRecord":v=s.getWidgetCache(u,"engagement_id",!0),g={type:"getEngagementRecordResponse",replyForMsgId:h.msgId,parameters:{id:v,data:pa(s,v)}},n(e,g);break;case"onQuestionnaireSubmit":g={type:"onQuestionnaireSubmitResponse",replyForMsgId:h.msgId},o.onQuestionnaireSubmitCallbacks?o.onQuestionnaireSubmitCallbacks.doCallbacksAsync(no.load(f.data)).then((function(t){g.parameters=t.toJson(),n(e,g)})):(g.parameters=JSON.stringify(f),n(e,g));break;case"getParameters":g={type:"getParametersResponse",replyForMsgId:h.msgId,parameters:{data:d}},n(e,g);break;case"setEngagementRecord":v=s.getWidgetCache(u,"engagement_id",!0),fa(s,v,f.data);break;case"createEngagementRecord":v=r.createEngagementRecord(l),s.setWidgetCache(u,"engagement_id",v,!0),g={type:"createEngagementRecordResponse",replyForMsgId:h.msgId,parameters:{id:v,data:r.getEngagementRecord(v)}},n(e,g);break;case"getWidgetInitData":g={type:"getWidgetInitDataResponse",replyForMsgId:h.msgId,parameters:{data:{clientHref:window.location.href,parameters:l.parameters,configuration:l.configuration,translation:o.localization.data}}},n(e,g);break;case"getConfiguration":g={type:"getConfigurationResponse",replyForMsgId:h.msgId,parameters:{data:l.configuration}},n(e,g);break;case"getCache":g={type:"getCacheResponse",replyForMsgId:h.msgId,parameters:{key:f.key,value:s.getWidgetCache(u,f.key,f.persist)}},n(e,g);break;case"getCacheData":g={type:"getCacheDataResponse",replyForMsgId:h.msgId,parameters:{key:f.key,value:s.getData(f.key)}},n(e,g);break;case"getTranslation":g={type:"getTranslationResponse",replyForMsgId:h.msgId,parameters:{value:o.localization.data}},n(e,g);break;case"getOtherCache":g={type:"getOtherCacheResponse",replyForMsgId:h.msgId,parameters:{key:f.key,value:s.getWidgetCache(u,f.key,f.persist)}},n(e,g);break;case"getWidgetPath":var m=s.getWidgetCache("chat","widgetpath",!0);m||(m=s.getWidgetCache("kbot","widgetpath",!0)),g={type:"getWidgetPathResponse",replyForMsgId:h.msgId,parameters:{key:"widgetpath",value:m}},n(e,g);break;case"setCache":s.setWidgetCache(u,f.key,f.value,f.persist);break;case"setStoreCache":s.storagePlugin.set(f.key,f.value,!0);break;case"removeStoreCache":s.storagePlugin.del(f.key,f.persist),g={type:"removeStoreCacheResponse",replyForMsgId:h.msgId,parameters:{data:"clearedStore"}},n(e,g);break;case"removeCache":s.removeWidgetCache(u,f.key,f.persist);break;case"notificationMessage":if(br(c)||Sr(c))return;f.title&&(f.title=o.getTranslation(na(u),f.title)),l.parameters.title=f.title,l.parameters.message=f.message,l.parameters.icon=f.icon,l.parameters.callToAction=f.callToAction,l.parameters.notificationType=2,l.notificationType=2,r.showNotification(l);break;case"updateWidgetTitle":r.updateWidgetTitle(u,f);break;case"updateTabText":$n("#concierge .con_tab_text").text(f.text);break;case"hideWidget":l.hideWidget();break;case"setServiceLineId":r.setServiceLineId(f,u);break;case"setActive":f.active?Hr(c,l):Br(c,l);break;case"handleClose":s.setWidgetCache(u,"willHandleClose",f.value,!0);break;case"callFunction":g={type:"callFunctionResponse",replyForMsgId:h.msgId,parameters:{}},l[f.funcName]&&(g.parameters.result=l[f.funcName](f.funcArgs)),g.parameters&&g.parameters.result&&n(e,g);break;case"broadcast":r.handleBroadcast(u,f.eventType,f.data)}}}}}}function fo(e){if(!e)return"";var t=e.match(/(https?:\/\/)([^/]+)/);return t?t[2]:""}var po=function(e,t){e&&e.source&&e.source.postMessage(ya(t),e.origin)},vo=function(e,t,n,i,r){var a=[],o=[],s={doPostMessage:function(e,t){a.push(t)}};return r.calls.forEach((function(i){i.parameters.signature=r.signature,i.parameters.widget=t,i.widget=t;var c=a.length,u=!1;try{e.bridgeListener({data:i,origin:n.origin},s)}catch(e){u=!0,a.push(null),o.push(e.name)}u||(o.push(null),a.length===c&&a.push(null))})),{type:"_multiResponse",replyForMsgId:i.msgId,parameters:{success:a,failure:o}}};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var mo,wo=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){ /*! * displacejs.js 1.3.2 - Tiny javascript library to create moveable DOM elements. * Copyright (c) 2019 Catalin Covic - https://github.com/catc/displace * License: MIT */ e.exports=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){var i=function(e){return e&&e.__esModule?e:{default:e}}(n(1));e.exports=i.default},function(e,t,n){function i(){var e=this,t=this.el,n=this.opts||s,i={};if(t.style.position="absolute",this.handle=n.handle||t,n.constrain){for(var c=n.relativeTo||t.parentNode,u=t,l=0,d=0;u!==c;)u=u.parentNode,(0,r.isRelative)(u)&&(l-=u.offsetLeft,d-=u.offsetTop),u===c&&(l+=u.offsetLeft,d+=u.offsetTop);var g=l+c.offsetWidth-t.offsetWidth,h=d+c.offsetHeight-t.offsetHeight;i.xClamp=(0,r.generateClamp)(l,g),i.yClamp=(0,r.generateClamp)(d,h)}this.opts=n,this.data=i,this.events={mousedown:a.mousedown.bind(this),mouseup:a.mouseup.bind(this),touchstart:a.touchstart.bind(this),touchstop:a.touchstop.bind(this),scrollFix:function(t){e.isDragging&&t.preventDefault()}},this.handleMove=o(this.opts.customMove),this.handle.addEventListener("mousedown",this.events.mousedown,!1),this.handle.addEventListener("touchstart",this.events.touchstart,!1),document.addEventListener("touchmove",this.events.scrollFix,{passive:!1})}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),a=n(3),o=(0,r.generateMoveFn)(),s={constrain:!1,relativeTo:null,handle:null,ignoreFn:null,highlightInputs:!1,onMouseDown:null,onMouseMove:null,onMouseUp:null,onTouchStart:null,onTouchMove:null,onTouchStop:null,customMove:null},c=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw Error("Must include moveable element");this.el=t,this.opts=n,i.call(this)}return e.prototype.reinit=function(){this.destroy(),i.call(this)},e.prototype.destroy=function(){var e=this.events;this.handle.removeEventListener("mousedown",e.mousedown,!1),document.removeEventListener("mousemove",e.mousemove,!1),document.removeEventListener("mouseup",e.mouseup,!1),this.handle.removeEventListener("touchstart",e.touchstart,!1),document.removeEventListener("touchmove",e.touchmove,!1),document.removeEventListener("touchstop",e.touchstop,!1),document.removeEventListener("touchmove",this.events.scrollFix,{passive:!1})},e}();t.default=function(e,t){return new c(e,t)}},function(e,t){function n(e,t,n){e.style.left=t+"px",e.style.top=n+"px"}Object.defineProperty(t,"__esModule",{value:!0}),t.generateClamp=function(e,t){return function(n){return Math.min(Math.max(n,e),t)}},t.isRelative=function(e){return"relative"===window.getComputedStyle(e).position},t.generateMoveFn=function(){return window.requestAnimationFrame?function(e){var t=e||n;return function(e,n,i){window.requestAnimationFrame((function(){t(e,n,i)}))}}:function(e){return function(t,i,r){(e||n)(t,i,r)}}}},function(e,t){function n(e,t,n){var i=this.el,r=this.opts,a=this.data;"function"==typeof r.onMouseMove&&r.onMouseMove(i,n);var o=n.clientX-e,s=n.clientY-t;return r.constrain&&(o=a.xClamp(o),s=a.yClamp(s)),this.handleMove(i,o,s),n.preventDefault(),!1}function i(e,t,n){var i=this.el,r=this.opts,a=this.data;"function"==typeof r.onTouchMove&&r.onTouchMove(i,n);var o=n.targetTouches[0],s=o.clientX-e,c=o.clientY-t;return r.constrain&&(s=a.xClamp(s),c=a.yClamp(c)),this.handleMove(i,s,c),n.preventDefault(),!1}Object.defineProperty(t,"__esModule",{value:!0}),t.mousedown=function(e){var t=this.opts;if(t.highlightInputs){var i=e.target.tagName.toLowerCase();if("input"===i||"textarea"===i)return}if(!t.ignoreFn||!t.ignoreFn(e)){if(0===e.button){var r=this.el,a=this.events;"function"==typeof t.onMouseDown&&t.onMouseDown(r,e);var o=e.clientX-r.offsetLeft,s=e.clientY-r.offsetTop;a.mousemove=n.bind(this,o,s),document.addEventListener("mousemove",a.mousemove,!1),document.addEventListener("mouseup",a.mouseup,!1)}e.preventDefault()}},t.mousemove=n,t.mouseup=function(e){var t=this.el,n=this.opts,i=this.events;"function"==typeof n.onMouseUp&&n.onMouseUp(t,e),document.removeEventListener("mouseup",i.mouseup,!1),document.removeEventListener("mousemove",i.mousemove,!1)},t.touchstart=function(e){var t=this.opts;if(t.highlightInputs){var n=e.target.tagName.toLowerCase();if("input"===n||"textarea"===n)return}if(!t.ignoreFn||!t.ignoreFn(e)){var r=this.el,a=this.events;"function"==typeof t.onTouchStart&&t.onTouchStart(r,e);var o=e.targetTouches[0],s=o.clientX-r.offsetLeft,c=o.clientY-r.offsetTop;a.touchmove=i.bind(this,s,c),this.isDragging=!0,document.addEventListener("touchmove",a.touchmove,!1),document.addEventListener("touchend",a.touchstop,!1),document.addEventListener("touchcancel",a.touchstop,!1)}},t.touchmove=i,t.touchstop=function(e){this.isDragging=!1;var t=this.el,n=this.opts,i=this.events;"function"==typeof n.onTouchStop&&n.onTouchStop(t,e),document.removeEventListener("touchmove",i.touchmove,!1),document.removeEventListener("touchend",i.touchstop,!1),document.removeEventListener("touchcancel",i.touchstop,!1)}}])})),yo=(mo=wo)&&mo.__esModule&&Object.prototype.hasOwnProperty.call(mo,"default")?mo.default:mo;wo.displacejs;function bo(e){this.shouldDisplayBell=!1,this.KNOWN_WIDGETS={chat:{requires:["portalId","host"]},email:{requires:["mailboxId"]},kb:{requires:["articleLimit","portalId","searchText"]},kbot:{requires:["portalId","host"]},"cxone-expert":{requires:["siteId","searchText"]}},this.notificationType=0;var t=navigator;this.concierge=e,this.journeyViewManager=new Ja(e),this.stashedConciergeCss={top:"",bottom:""},this.needsForceBlur=!1,this.state="tab",this.device=J(t),this.openWidget=!1,this.widgetLoadPromises={},this.windowHasDragResize=!1,xe.log("WidgetManager constructor: device="+this.device),"Mobile"===this.device?this.widgetsType=new qa(this):this.widgetsType=new Va(this),this.bridgeListener={},this.initDraggableData()}function So(e){var t,n=e.concierge.cacheManager;return e.tabStyle=e.tabStyle||{verticalOffset:"100",verticalAnchor:1,horizontalOffset:"20",cascade:1},n&&e.engagementWidgets&&(t=e.engagementWidgets).conciergeTab&&t.conciergeTab.tabStyle&&(void 0!==t.conciergeTab.tabStyle.verticalOffset&&(e.tabStyle.verticalOffset=t.conciergeTab.tabStyle.verticalOffset),void 0!==t.conciergeTab.tabStyle.verticalAnchor&&(e.tabStyle.verticalAnchor=t.conciergeTab.tabStyle.verticalAnchor),void 0!==t.conciergeTab.tabStyle.horizontalOffset&&(e.tabStyle.horizontalOffset=t.conciergeTab.tabStyle.horizontalOffset),void 0!==t.conciergeTab.tabStyle.cascade&&(e.tabStyle.cascade=t.conciergeTab.tabStyle.cascade)),e.tabStyle}function Co(e,t){var n,i,r,a,o,s=t.widget,c={},u=e.engagementWidgets.widgets[s].parameters;return"email"===s?(r="mailboxId",i="mailbox ID"):(r="portalId",i="portal ID"),u&&(o=u[r],n=u.host),(a=t[r]||o)||xe.log("No Moxie "+i+" specified for engagement."),c[r]=a,ta(s)&&function(e,t,n){var i=e||t;i||xe.log("No Moxie chat host specified for engagement.");n.host=i}(t.host,n,c),c}function _o(e){window.MOXIE_CONCIERGE&&delete window.MOXIE_CONCIERGE.startEngagement,e.dataStartListener&&(un(document,"click",e.dataStartListener),delete e.dataStartListener),e.windowHasDragResize&&(on(window,"resize",e.dragResizeHandler.bind(this)),e.windowHasDragResize=!1),function(e){e.bridgeListener&&(window.removeEventListener("message",e.bridgeListener,!1),delete e.bridgeListener)}(e)}function Eo(e){e.initEngagementWidgets(),go(e),So(e),function(e){var t=e.widgetsType.html();t=t.replace(/\/DEVICE\//g,e.device);var n=!1;if(e.concierge.cacheManager&&e.engagementWidgets&&(n=e.engagementWidgets).conciergeTab&&n.conciergeTab.icon&&n.conciergeTab.icon.svg){var i=n.conciergeTab.icon.svg;t=t.replace(//g,i)}var r=$n(t=Ca(t)({concierge:e.concierge,CONCIERGE_TAB_ICON_SVG:e.engagementWidgets.conciergeTab.icon.svg,CON_CLOSED:ia(e)?" single-channel":"",CON_ROLE_ATTRIBUTE:ia(e)?"":' role="menu"',CLOSE_ICON:e.concierge.getTranslation("common","CLOSE_ICON"),CONCIERGE:e.concierge.getTranslation("common","CONCIERGE"),NOTIFICATION_ANNOUNCE:e.concierge.getTranslation("common","NOTIFICATION_ANNOUNCE")})),a=function(t){if("click"===t.type||13===t.which||32===t.which)return e.closeWidget(!1),!1};cn(r,"click",ln("con-close-area"),a),cn(r,"keypress",ln("con-close-area"),a);var o=ln("con-widget-title-section");cn(r,"keyup",o,(function(){return $t(this,{outline:"-webkit-focus-ring-color auto 5px"}),!1})),cn(r,"blur",o,(function(){return $t(this,{outline:"none"}),!1}));var s=function(t){if("click"===t.type&&$t(this,{outline:"none"}),"click"===t.type||13===t.which||32===t.which){var n=$n(this).closest(".concierge-widget").data("widget");e.postMessageToWidget(n,"titleClicked");var i=e.engagementWidgets.widgets[n];return i.titleBar.onclick&&i.titleBar.onclick(e),!1}};cn(r,"click",o,s),cn(r,"keypress",o,s),e.widgetsType.beforeAppend&&e.widgetsType.beforeAppend(r),$n("body").append(r[0]),r.hide()}(e);var t=$n("#concierge .con-icon svg");void 0!==t&&t.length>0&&oa(t[0]),e.$concierge=$n("#concierge"),e.widgetsType.start()}bo.prototype.startExternal=function(e,t){var n=this,i=!0===t.enableChatDeflection||"true"===t.enableChatDeflection;null!==t.widget&&void 0!==t.widget||(t.widget=t.startEngagement),"chat"===t.widget&&i&&(t.widget="kbot");var r=[];"kbot"===t.widget||"chat"===t.widget?(r.push("kbot"),r.push("chat")):r.push(t.widget);var a,o=null;if(r.forEach((function(e){null===o&&(function(e,t){var n=!1;return Object.keys(e.spots).forEach((function(i){var r=e.spots[i];r.widget&&r.widget.name===t&&(n=r.twiddled)})),n}(n.wmState,e)&&(o=e))})),null!==o){var s=L.resolve(null);return xe.log('WidgetManager.startExternal not starting widget "'+t.widget+'" because the spot is twiddled'),(null!==(a=this.wmState).open&&void 0!==a.open?a.open.name:null)!==o&&(xe.log('WidgetManager.startExternal is showing existing widget "'+o+'"'),"tab"===this.state&&this.widgetsType.openWidgetMenu&&(s=s.then((function(){return n.widgetsType.openWidgetMenu()}))),s=s.then((function(){return n.showWidget(n.findWidget(o))}))),s.then((function(){return{status:!1}}))}delete t.startEngagement,delete t.enableChatDeflection,t.ruleSource=e;var c=["externalLink","externalAPI"];if(t.ruleId=-1*(1+c.indexOf(e)),t.action="success",null===t.widget||void 0===t.widget||""===t.widget)return xe.log("WidgetManager.startExternal invoked with improper widget specification"),L.resolve({status:!1,invalid:!0});var u=this;hn(t,Co(this,t));var l=null;l="kbot"===t.widget?["kbot","chat"]:"chat"===t.widget?["chat","kbot"]:[t.widget];var d=L.resolve(null);return l.forEach((function(e){var t=n.findWidget(e);null!=t&&(xe.log('WidgetManager.startExternal Removing widget: "'+e+'"'),d=d.then((function(){return u.removeWidget(t,!0)})))})),d.then((function(){return function(e,t){var n={name:t.ruleName,source:t.ruleSource,id:t.ruleId,action:t.action},i=L.resolve();return i=i.then((function(){if(e.notificationDisplayed())return xe.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): is closing the notification"),Wr(e.wmState)})).then((function(){return e.addWidget(t,n)})).then((function(n){if(n&&void 0!==n.status&&!1===n.status)return xe.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): halted because addWidget failed"),n;var i=L.resolve(null);return!1!==e.openWidget&&e.openWidget!==t.widget&&(i=i.then((function(){return e.hideWidget(!0)}))),i.then((function(){return e.showWidget(n.ref)})).then((function(){return e.showConcierge()})).then((function(){return e.widgetsType.openConcierge()})).then((function(){return{ref:n.ref,status:!0}}))})).catch((function(e){return xe.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): failed: "+e),xe.log(e.stack),Zr}))}(n,t)}))},bo.prototype.findWidget=function(e){for(var t in this.wmState.spots){var n=this.wmState.spots[t];if(n.widget&&n.widget.name===e)return n.widget;if(n.reactive&&n.reactive.name===e)return n.reactive}return this.wmState.offer&&this.wmState.offer.name===e?this.wmState.offer:this.engagementWidgets.widgets[e]},bo.prototype.initDraggableData=function(){this.widgetAreaDragData||(this.widgetAreaDragData={draggedByUser:!1,initialElemData:null,currentElemData:null,parentData:null,resizedWhileMinimized:!1})},bo.prototype.removeDraggableData=function(){delete this.widgetAreaDragData},bo.prototype.dragStartHandler=function(e,t){this.$concierge.find("#concierge-iframe-cover").show(),Zt(e,"is-dragging"),this.widgetAreaDragData.currentElemData=e.getBoundingClientRect(),this.widgetAreaDragData.parentData=e.parentNode.getBoundingClientRect(),this.widgetAreaDragData.draggedByUser||($n(e).addClass("free-floating"),this.widgetAreaDragData.initialElemData=this.widgetAreaDragData.currentElemData,this.widgetAreaDragData.draggedByUser=!0)},bo.prototype.dragMaxCalculations=function(){var e,t=document.body.getBoundingClientRect().width-this.widgetAreaDragData.parentData.left,n=0-(this.widgetAreaDragData.currentElemData.width-t),i=this.widgetAreaDragData.parentData.right-this.widgetAreaDragData.initialElemData.right-this.widgetAreaDragData.parentData.width,r=this.widgetAreaDragData.currentElemData.width+i,a=0-r;this.widgetAreaDragData.parentData.left>r&&(a=0-this.widgetAreaDragData.parentData.left);var o=window.visualViewport?window.visualViewport.height:window.innerHeight;if(1===this.tabStyle.verticalAnchor){var s=o-this.widgetAreaDragData.parentData.top;e=0-this.widgetAreaDragData.currentElemData.height+s}else e=o-this.widgetAreaDragData.currentElemData.height-this.widgetAreaDragData.initialElemData.top;return{minX:a,maxX:n,minY:0-this.widgetAreaDragData.parentData.top,maxY:e}},bo.prototype.dragMoveHandler=function(e,t,n){if(this.widgetAreaDragData.currentElemData){var i=this.dragMaxCalculations(),r=i.minX,a=i.maxX,o=i.minY,s=i.maxY;t=Math.min(t,a),t=Math.max(t,r),n=Math.min(n,s),n=Math.max(n,o)}this.widgetAreaDragData.x=t,this.widgetAreaDragData.y=n,$t(e,{left:this.widgetAreaDragData.x,top:this.widgetAreaDragData.y})},bo.prototype.dragConfigData=function(){return{moveableWidgets:this.engagementWidgets.globalSettings.moveableWidgets,tabStyle:this.tabStyle}},bo.prototype.isDragConfigDataEqualToCurrent=function(e){if("object"!=typeof e)return!1;var t=this.dragConfigData();if(e.moveableWidgets!==t.moveableWidgets||"object"!=typeof e.tabStyle||"object"!=typeof t.tabStyle)return!1;for(var n=["cascade","horizontalOffset","verticalAnchor","verticalOffset"],i=0;i')}o.attr("title",a)}var u=n.find(".concierge-widget-header .con-widget-title-section");t.hasCallback?u.addClass("clickable-title").addClass(".clickable-title"):u.removeClass("clickable-title").removeClass(".clickable-title")},bo.prototype.makePositionAbsolute=function(){var e;"absolute"!==this.$concierge.css("position")&&(this.stashedConciergeCss=this.$concierge.css(["top","bottom"]),e=this.$concierge.offset().top,this.$concierge.css({position:"absolute",top:e,bottom:""}))},bo.prototype.makePositionFixed=function(){var e,t;"fixed"!==this.$concierge.css("position")&&this.stashedConciergeCss&&(t="auto"!==this.stashedConciergeCss.top?"top":"bottom",e=this.$concierge.offset().top-document.body.scrollTop,this.$concierge.css({position:"fixed",top:e,bottom:"auto"}),"top"===t?this.$concierge.animate({top:this.stashedConciergeCss.top},{label:"makePositionFixedTop"}):this.$concierge.animate({top:tt()-parseInt(this.stashedConciergeCss.bottom,10)-this.$concierge.height()},{label:"makePositionFixedBottom",done:function(){this.$concierge.css({top:"auto",bottom:this.stashedConciergeCss.bottom})}.bind(this)}))},bo.prototype.handleGetTabInfo=function(e,t){var n=this.concierge.cacheManager.getWidgetCache(t,"cookieId",!0);n||(n=Math.ceil(1e5*Math.random()),this.concierge.cacheManager.setWidgetCache(t,"cookieId",n,!0)),e.source.postMessage(JSON.stringify(ya({origWindowName:window.name,cookieID:n,currentOrigin:window.location.protocol+window.location.host,previousOrigin:window.location.protocol+window.location.host,sessionId:this.concierge.cacheManager.getWidgetCache(t,"sessionId")})),e.origin)},bo.prototype.handleSetChatInProgress=function(e,t,n){var i=this.engagementWidgets.widgets[t];i&&void 0!==i.sendSearchGuid&&i.sendSearchGuid(e,n),this.concierge.cacheManager.setWidgetCache(t,"sessionId",Math.abs(parseInt(e))),e>0?this.markChat(e,"start"):e<0&&this.markChat(e,"end")},bo.prototype.setNotificationType=function(e){return e>=0&&e<=2&&(this.notificationType=e,!0)},bo.prototype.handleBroadcast=function(e,t,n){if(this[e+"HandleBroadcast"]&&this[e+"HandleBroadcast"](e,t,n))return L.resolve(!0);var i=this,r=this.engagementWidgets.widgets[e],a="widget:"+na(e)+":"+t;return(r&&r.updateBroadcastPayload?r.updateBroadcastPayload(a,n):L.resolve(n)).then((function(t){switch(function(e,t,n,i){try{switch(n){case"widget:chat:agentJoinedSession":ee(e.concierge,!0,t,i.agentId,i.agentName,i.sessionId,i.serviceLine,i.serviceLineId,i.currentServiceLineId);break;case"widget:chat:agentLeftSession":i.agentId&&ee(e.concierge,!1,t,i.agentId,i.agentName,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:chatSessionActive":te(e.concierge,i.sessionId,i.chatState,t);break;case"widget:chat:chatSessionSuspend":ne(e.concierge,i.sessionId,t);break;case"widget:chat:chatSessionResume":ie(e.concierge,i.sessionId,t);break;case"widget:chat:articleViewed":case"widget:kb:articleViewed":case"widget:cxone-expert:articleViewed":ae(e.concierge,t,i.articleId,i.articleTitle);break;case"widget:chat:articleRated":case"widget:kb:articleRated":case"widget:cxone-expert:articleRated":oe(e.concierge,t,i.articleId,i.articleTitle,i.search,i.ratingType,i.rating);break;case"widget:chat:articleCommented":case"widget:kb:articleCommented":case"widget:cxone-expert:articleCommented":se(e.concierge,t,i.articleId,i.articleTitle,i.search,i.ratingType,i.rating,i.comment);break;case"widget:chat:chatSessionStarted":re(e.concierge,!0,t,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:chatSessionEnded":re(e.concierge,!1,t,i.sessionId,i.serviceLine,i.serviceLineId),function(e,t){var n=t.sessionId;n&&e.concierge.cacheManager.setWidgetCache("kbot","lastChatSessionEnded",n,!1)}(e,i);break;case"widget:email:emailSent":ce(e.concierge,t,i.mailboxId);break;case"widget:kb:portalSearched":case"widget:cxone-expert:portalSearched":case"widget:chat:portalSearched":fe(e.concierge,t,i.searchText,i.portalId,i.articlesList);break;case"widget:chat:prechatQuestionnaireComplete":pe(e.concierge,t,i.serviceLine,i.serviceLineId)}}catch(e){xe.log("Error in processBroadcast"+e)}}(i,e,a,t),a){case"widget:chat:agentJoinedSession":t.device=i.concierge.contextMonitor.getLastDevice(),t.type=i.concierge.widgetManager.engagementWidgets.widgets[e].proactive?"PROACTIVE":"REACTIVE",Xn(a,t);break;default:Xn(a,t)}return null})).catch((function(e){xe.log("handleBroadcast Error:"+e)}))},bo.prototype.markChat=function(e,t){var n=this.concierge.cacheManager.getData("profileJSON"),i=this.journeyViewManager.markChat(n,e,t);this.concierge.cacheManager.setData("profileJSON",JSON.stringify(i))},bo.prototype.showNotification=function(e){xe.log("WidgetManager.showNotification called:",e.name),this.wmState.notification!==e&&Wr(this.wmState),this.wmState.notification=e,function(e,t){var n=t.parameters,i=n.title,r=n.message,a=n.icon,o=n.callToAction,s=e.widgetsType.getNotification();s.attr("data-spot",t.spot),s.attr("data-widget",t.name),s.find(".concierge-notification-title").text(i||""),s.find(".con-notification-body").html(ca(r));var c=s.find(".con-notification-calltoaction");o&&o.length?(c.show(),c.html(ca(o)),c.attr("tabindex","0")):(c.hide(),c.attr("tabindex","-1"));var u=s.find(".con-notification-icon"),l="";if(a){u.show();var d=e.concierge.scriptLocation+"";Le(d,"/")||(d+="/"),l=''}else u.hide();u.html(l)}(this,e),this.widgetsType.displayNotification(e,e.engagementId),this.setNotificationType(e.notificationType);var t,n,i=na(e.name);Xn("notification",{engagementId:e.engagementId,notificationType:ua(e.notificationType),widgetName:i,status:"displayed",rule:e.parameters.rule}),1===e.notificationType&&(t=this.concierge,n=Date.now(),t.cacheManager.setClientCache("lastNotified",n),Xn("proactiveOffer",{widgetName:i,status:"displayed",rule:e.parameters.rule,device:this.concierge.contextMonitor.getLastDevice()}),this.concierge.currentOfferCreatedAt=Date.now(),de(this.concierge,i,e.parameters.rule))},bo.prototype.notificationDisplayed=function(){return Cr(this.wmState)},bo.prototype.broadcastCloseProactiveNotification=function(e,t){var n=e.parameters;Xn("proactiveOffer",{widgetName:n.widget,status:t,rule:n.rule,device:this.concierge.contextMonitor.getLastDevice()}),"accepted"===t?ge(this.concierge,n.widget,n.rule):"declined"===t&&he(this.concierge,n.widget,n.rule)},bo.prototype.postMessageToWidget=function(e,t,n){var i,r,a=this,o=this.engagementWidgets.widgets[e],s=this.concierge.cacheManager.getWidgetCache(e,"active_session");"willClose"!==t&&"willTerminate"!==t||Br(this.wmState,o),s&&o.remoteURL&&n?(r=ta(e)&&"object"==typeof o.remoteURL?o.remoteURL[o.portalId]:o.remoteURL,i=r.match(/^https?:\/\/[^/]+/)[0]):i="*";var c=this.widgetAreaIFrameForWidget(e);if(c.length){var u=c[0].contentWindow,l={widget:e,type:t,parameters:n},d=function(){u.postMessage(ya(l),i),xe.log(l.type+" message posted to : "+i),"willTerminate"===t&&a.handleBroadcast(e,"widgetTerminated",{})},g=c.data("loadPromise");return g?g.then(d):Zn(d)}return"willTerminate"===t&&a.handleBroadcast(e,"widgetTerminated",{}),L.resolve()},bo.prototype.callWidgetFunction=function(e,t,n){var i,r,a=this.engagementWidgets.widgets[e];a.remoteURL?(r=ta(e)&&"object"==typeof a.remoteURL?a.remoteURL[a.portalId]:a.remoteURL,i=r.match(/^https?:\/\/[^/]+/)[0]):i="*";var o=this.widgetAreaIFrameForWidget(e),s=o[0].contentWindow,c={widget:e,type:"functionCall",parameters:{functionName:t,functionData:n}},u=function(){s.postMessage(ya(c),i),xe.log(c.type+" message posted to : "+i)};return o.data("loaded")?L.resolve(u()):(o.data("loadPromise")||L.resolve()).then(u)},bo.prototype.writeSrcToIframe=function(e){if(e!=F){var t=this.widgetAreaIFrameForWidget(e);if(t.length>0){var n=this.concierge.scriptLocationWithBrand+"/widgets/"+e+"/"+this.concierge.assetVersion.widgets+"/index.html";t.attr("src",n)}}},bo.prototype.widgetAreaForWidget=function(e){return this.$concierge.find("#concierge-widget-"+e)},bo.prototype.widgetAreaIFrameForWidget=function(e){return this.widgetAreaForWidget(e).find("iframe")},bo.prototype.loadWidget=function(e){var t=e.name,n=e.parameters,i=e.engagementId;if(xe.log('WidgetManager.loadWidget("'+t+'", "'+JSON.stringify(n)+'", '+i+'"): invoked.'),!this._disabled){var r=i;if(!e.state){"externalAPI"!==n.rule.source&&(e.widgetParameters=n);var a=$n("#concierge-widget-area");if(0===this.widgetAreaForWidget(t).length){var o={widget:e,widgetName:t,CLOSE_ICON:this.concierge.getTranslation("common","CLOSE_ICON"),FOOTER:this.concierge.getTranslation("common","FOOTER")},s="";this.engagementWidgets.globalSettings&&!this.engagementWidgets.globalSettings.hideMoxieBranding&&(s=Ca('')(o)),o.moxieBranding=s;var c=t==F?Ca("
    ")(o):Ca('
    \n
    \n
    \n
    \n

    <%= widget.title %>

    \n
    \n
    \n \n
    \n
    \n\n
    \n \n \n <%= moxieBranding %>\n
    \n')(o);c=c.replace(/\/SCRIPT_LOCATION\//g,this.concierge.scriptLocation+"/"),a.append(c)}void 0===i&&(i=this.createEngagementRecord(e),r=i),e.state=2,e.proactive=n&&n.proactive||!1,xe.log("WidgetManager.loadWidget("+t+"): set widget.proactive="+e.proactive),e.beforeLoad();var u=this,l=this.concierge.cacheManager.getWidgetCache(t,"active_session");if(l||e.shouldReplaceIframeSrc){var d=this.widgetAreaIFrameForWidget(t),g=e.getRemoteURL();xe.log("WidgetManager.loadWidget("+t+"): requests iframe src="+g,"hasActive:",l,"shouldReplace:",e.shouldReplaceIframeSrc),d.data("loadPromise",i=new L((function(e){d.attr("src",g),d.on("load",(function(){d.data("loaded")||(d.data("loaded",!0),e(r))}))})))}else void 0!==e.prepareToLoadPromise?e.prepareToLoadPromise.then((function(){u.writeSrcToIframe(t)})):this.writeSrcToIframe(t);this.updateWidgetTitle(t,{text:e.titleBar&&e.titleBar.text?"title":"",graphic:e.titleBar&&e.titleBar.graphic?e.titleBar.graphic:null})}var h=this.concierge.getTranslation(t,"title","Concierge");return this.widgetAreaIFrameForWidget(t).attr("title",h),i}},bo.prototype.replaceWidget=function(e){var t=this,n={status:!0,ref:e,parameters:e.parameters,ruleSettings:this.concierge.rulesEngine.getSiteSettings(),engagementId:e.engagementId};return e.beforeAdd(n).then((function(n){return n&&n.status&&xr(t.wmState,e,!0),n}))},bo.prototype.getSeenChannelsHosts=function(){return this.seenChannelsHosts||(this.seenChannelsHosts=this.concierge.cacheManager.getClientCache("channelsHosts",!0)||[]),this.seenChannelsHosts},bo.prototype.registerChatHost=function(e){var t=this.getSeenChannelsHosts();Ae(t,e)<0&&(t.push(e),this.seenChannelsHosts=t,this.concierge.cacheManager.setClientCache("channelsHosts",t,!0))},bo.prototype.showWidget=function(e){var t=e.name,n=e.parameters,i=e.engagementId,r=this.wmState;xe.log("WidgetManager.showWidget("+t+", "+JSON.stringify(e.parameters)+", "+i+"): invoked.");var a=L.resolve();if(e){var o=this,s=$n("#concierge-widget-area");ta(t)&&n.host&&this.registerChatHost(n.host),a=a.then((function(){return e.spot&&ra(r,e)?o.replaceWidget(e):"function"==typeof e.shouldRebuildIframe&&e.shouldRebuildIframe()?(o.widgetAreaIFrameForWidget(t).replaceWith(''),Zn((function(){o.writeSrcToIframe(t)})).then((function(){return o.concierge.cacheManager.removeWidgetCache(t,"rebuildIframe",!1)}))):void 0})).then((function(){e.proactive=n&&n.proactive||!1,xe.log("WidgetManager.showWidget("+e.label()+"): set widget.proactive="+e.proactive)})).then((function(){return e.state?L.resolve(o.postMessageToWidget(t,"willShow",n)).then((function(){return o.concierge.cacheManager.getWidgetCache(t,"engagement_id",!0)})):o.loadWidget(e)})).then((function(n){return n&&null!==o.getEngagementRecord(n)||(n=o.createEngagementRecord(e)),e.engagementId=i=n,o.concierge.cacheManager.setWidgetCache(t,"engagement_id",i,!0)})).then((function(){var e,n=o.getEngagementRecord(i);if(ta(t)){if(null===n)xe.log('WidgetManager.showWidget("'+i+'"): was null.');else if(n.proactive&&void 0===n.chat.time_to_decide){var r=new Date(n.time).getTime();n.chat.time_to_decide=Math.round(((new Date).getTime()-r)/1e3),n.chat.missed_reason=0,n.decision_type="Accepted",e=o.setEngagementRecord(i,n)}}else null!==n&&n.proactive&&(n.decision_type="Accepted",e=o.setEngagementRecord(i,n));return e||(e=L.resolve()),e.then((function(){return o.concierge.contextMonitor.recordEngagementValue()}))})).then((function(){if(o.notificationDisplayed())return xe.log("WidgetManager.showWidget("+e.label()+"): ignoring the notification"),Wr(r)})).then((function(){return s.addClass("con-open"),o.$concierge.addClass("con-open-widget"),r.open=e,Tr(o.wmState,e.spot),e.name!=F&&"undefined"!=typeof brandembassy&&brandembassy("hideChatWindow"),o.openWidget!==t?(o.widgetsType.openWidget(e),Xn("widgetOpened",{widgetName:t,source:n.rule.source}),o.openWidget=t):o.widgetsType.makeWidgetActive(o.widgetAreaForWidget(t)),null}))}return a},bo.prototype.forceBlur=function(){if(this.needsForceBlur){$n("#concierge").append('');var e=$n("#fakefocus");e.focus(),e.blur(),e.remove(),this.needsForceBlur=!1}},bo.prototype.hideWidget=function(e){var t=this,n=t.postMessageToWidget(t.openWidget,"willHide");return e||(n=n.then((function(){return sa(t,!1)}))),"undefined"!=typeof brandembassy&&brandembassy("hideChatWindow"),n},bo.prototype.closeWidget=function(e){var t=this,n=t.postMessageToWidget(t.openWidget,"willClose"),i=this.wmState.open;return e||t.concierge.cacheManager.getWidgetCache(t.openWidget,"willHandleClose",!0)||(n=n.then((function(){return sa(t,!0)})).then((function(){i&&i.closeWidget()}))),n},bo.prototype.fixPosition=function(e){this.widgetsType.fixPosition&&this.widgetsType.fixPosition(e,this.$concierge)},bo.prototype.expandConcierge=function(){xe.log("WidgetManager.expandConcierge(): invoked.")},bo.prototype.collapseConcierge=function(){xe.log("WidgetManager.collapseConcierge(): invoked.")},bo.prototype.preloadCSS=function(){return So(this),function(e){var t="concierge-style-"+e.widgetsType.cssType;return 0===$n("#"+t).length?new L((function(n){var i=e.concierge.scriptLocationWithBrand+"/widgets/"+e.concierge.assetVersion.widgets+"/"+e.widgetsType.cssType+".css",r=document.getElementsByTagName("head")[0],a=document.createElement("link");a.onload=function(){n(!0)},a.id=t,a.rel="stylesheet",a.type="text/css",a.href=i,a.media="all",r.appendChild(a)})):L.resolve(!0)}(this)},bo.prototype.init=function(){xe.log("WidgetManager.init(): invoked."),this.$concierge=$n("#concierge"),0===this.$concierge.length&&Eo(this)},bo.prototype.showConcierge=function(){xe.log("WidgetManager.showConcierge(): invoked."),$n("#concierge-widgets ul li").length>0&&$n("#concierge").show()},bo.prototype.hideConcierge=function(){xe.log("WidgetManager.hideConcierge(): invoked."),$n("#concierge").hide()},bo.prototype.getWidgetPath=function(){return this.concierge.cacheManager.getWidgetCache("chat","widgetpath",!0)||this.concierge.cacheManager.getWidgetCache("kbot","widgetpath",!0)},bo.prototype.setServiceLineId=function(e,t){var n=this;if(t&&t.parameters){var i=t.name,r=t.parameters;r.serviceLineId!==e.serviceLineId&&(r.serviceLineId=e.serviceLineId,this.concierge.serviceLines.getName(e.serviceLineId).then((function(i){return r.serviceLine=i,r.serviceLineId=e.serviceLineId,r.parameters&&r.parameters.queue&&(r.parameters.queue=e.serviceLineId),Hr(n.wmState,t),null})).catch((function(t){xe.log('setServiceLineId("'+i+'", '+JSON.stringify(e)+"): ERROR: "+t)})))}},bo.prototype.loadActiveWidgets=function(){var e=this,t=e.wmState.wm.concierge.cacheManager.getClientCache("activeWidgets")||[],n=null,i=[];e.loadingActiveWidgets=!0;for(var r=0;r0&&(i+=1333*Math.pow(n,2),i=Math.min(3e5,i)),new L((function(n,r){var a=new XMLHttpRequest;a.open("POST",t.serverEndpoint),a.timeout=i,a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Accept","application/json"),a.onload=function(e){return n({status:a.status,body:a.response})},a.onerror=function(e){return n({status:a.status,message:"Could not read error response, probably because CORS headers are missing."})},a.send(JSON.stringify(function(e){for(var t={e:[]},n={},i=JSON.parse(JSON.stringify(e)),r=0;r=a)return-1;if(i<0&&(i=Math.max(a+i,0)),void 0===t){do{if(i in r&&void 0===r[i])return i}while(++i0){n({type:e});var r=i().eventService.failureStreak;Bo(i().eventService.sending,t,r).then((function(t){t&&!i().eventService.terminating&&(t.status>=200&&t.status<300||t.status>=400&&t.status<500?(Uo(e,!0),n(Ko())):r>=8640?(Uo(e,!1),n(Ko())):(Uo(e,!1),n({type:"RETRY_SENT"})))}))}}};function zo(e){return Go("SEND_EVENTS",e)}function Ko(){return{type:"CLEAR_SENT"}}var Xo=function(e,t){void 0===t&&(t=function(e){return e}),this.timeout_in_ms=e,this.stateChangeCallbackFn=t,this.timerState="INITIALIZED"};Xo.prototype.timerInternalState=function(){return this.timerState},Xo.prototype.startTimer=function(e){var t=this;void 0===e&&(e=this.timeout_in_ms);this.timer=setTimeout((function(){t.timerState="EXPIRED",t.stateChangeCallbackFn("EXPIRED")}),e),this.timerState="RUNNING",this.stateChangeCallbackFn("RUNNING")},Xo.prototype.cancelTimer=function(){clearTimeout(this.timer),this.timerState="CANCELLED",this.stateChangeCallbackFn("CANCELLED")};var Qo=[function(e){var t={schemaVersion:1,eventService:hn({},e.eventService,{terminating:!1})};return hn({},e,t)}],Yo=function(e){var t=e.serverEndpoint.indexOf("-")+1,n=e.serverEndpoint.indexOf(".")-t;return e.serverEndpoint.substr(t,n)},Zo=function(e){return function(e,t){void 0===t&&(t=Qo);var n=e.schemaVersion||0,i=t.length;nt})),e}(JSON.parse(e)))},es=function(e){var t,n,i="moxie_"+Yo(e)+"EventState";try{var r=localStorage.getItem(i);return null===r?(t=i,n=localStorage.getItem("moxieState"),localStorage.removeItem("moxieState"),localStorage.setItem(t,n),null!=(r=n)?Zo(r):void 0):Zo(r)}catch(e){return}};function ts(e,t,n){e.subscribe((function(){var i=e.getState().eventService.prevState.eventsCount,r=e.getState().eventService.eventsCount;if(i!==r){var a=e.getState().eventService.prevState.lastServerCallOK,o=e.getState().eventService.lastServerCallOK,s=e.getState().eventService.priorityEventAdded,c=0===e.getState().eventService.sending.length;c&&s?(t.cancelTimer(),e.dispatch(function(e){return Go("SEND_PRIORITY_EVENTS",e)}(n))):c&&o&&r>=5?(t.cancelTimer(),e.dispatch(zo(n))):0===i&&r>=1?(t.cancelTimer(),o?t.startTimer():t.startTimer(1e4)):!0===a&&!1===o&&(t.cancelTimer(),t.startTimer(1e4))}})),e.subscribe((function(){var t=e.getState().eventService.prevState.batchTimerState,i=e.getState().eventService.batchTimerState;t!==i&&"EXPIRED"===i&&e.dispatch(zo(n))})),e.subscribe((function(){var t=e.getState().eventService.prevState.eventsCount,i=e.getState().eventService.eventsCount,r=e.getState().eventService.prevState.sending,a=e.getState().eventService.sending,o=e.getState().eventService.terminating;(t!==i||r!==a)&&!o&&function(e,t){var n="moxie_"+Yo(t)+"EventState";try{var i=JSON.stringify(e);localStorage.setItem(n,i)}catch(e){return}}(e.getState(),n)}))}var ns=function(e){if(this.store=null,this.batchTimer=null,this.config=e,this.startEventService(),void 0===this.config.serverEndpoint)throw"serverEndpoint config value is required for the EventService"};function is(e){this.scriptElement=e,this.engagementWidgetsVersion=null,this.engagementRulesVersion=null}ns.prototype.notifyEventService=function(e){this.store.dispatch({type:"ADD_EVENT",payload:e})},ns.prototype.notifyEventServiceImmediately=function(e){this.store.dispatch({type:"ADD_PRIORITY_EVENT",payload:e})},ns.prototype.startEventService=function(){var e=es(this.config);null!=e&&null!==e.eventService&&void 0!==e.eventService&&(e.eventService.failureStreak=0),this.store=To(Ho,e,function(){for(var e=arguments,t=arguments.length,n=new Array(t),i=0;i=11}else n="android"!==i[0]||parseFloat(i[1])>=5;else n=!1;return n}()}function as(){var e="Concierge failed to load: ";if(!rs())throw Xn("conciergeFailedToLoad",e+="unsupported browser"),new Error(e);if(!function(){var e=!1;try{e=void 0!==window.localStorage.getItem("MoxieUndefinedKey")}catch(e){xe.error(e)}return e}())throw Xn("conciergeFailedToLoad",e+="localStorage required"),new Error(e);return!0}is.prototype.prepare=function(e,t,n){n=n||{},$n("#concierge").remove(),this.url=e,this.pageTitle=t,this.scriptLocation=this.scriptElement.getScriptLocation(),this.brandId=this.scriptElement.getBrandId(),this.brandPrefix=this.brandId?"/brands/"+this.brandId:"",this.scriptLocationWithBrand=this.scriptLocation+this.brandPrefix,this.isTestMode=this.scriptElement.getTestMode(),this.logDisabled=this.scriptElement.getLogFlag(),this.clientName=this.scriptElement.getClientName(),this.positionMethod=this.scriptElement.getDisplayConfiguration().positionMethod,this.conciergeHost=this.scriptElement.getConciergeHost(),this.separator=this.scriptElement.getConciergeSeparator(),this.protocol=0===this.scriptLocation.indexOf("https:")?"https:":"http:",this.currentOfferCreatedAt=null,this.gomoxie=this.registerNamespace(),this.loadState="LOADING",this.serviceUrl={connector:this.protocol+"//connector"+this.separator+this.clientName+"."+this.conciergeHost,location:this.protocol+"//location."+this.conciergeHost,events:this.protocol+"//events"+this.separator+this.clientName+"."+this.conciergeHost+"/1.1/events"},this.assetVersion={rules:"",widgets:""},this.onQuestionnaireLoadedCallbacks=new tr,this.onQuestionnaireSubmitCallbacks=new tr,this.httpGet=this.httpGet||(new Gn).get,this.httpGetXMLHttpRequest=this.httpGetXMLHttpRequest||(new Gn).getXMLHttpRequest,this.localization=n.localization||new Zi(this),this.rulesEngine=n.rulesEngine||new sr(this),this.eventService=n.eventService||new ns({serverEndpoint:this.serviceUrl.events}),this.publicAPI=n.publicAPI||new wa,this.publicAPI.registerMethods(this,this.gomoxie),this.publicApiV2=n.publicApiV2||new ma(this,this.gomoxie),this.cacheManager=this.cacheManager||n.cacheManager||new Hi(this),this.widgetManager=n.widgetManager||new bo(this),this.contextMonitor=n.contextMonitor||new Yi(this),this.serviceLines=n.serviceLines||new nr(this)},is.prototype.prepareAndInit=function(e,t,n){return this.prepare(e,t,n),this.init()},is.prototype.initAPI=function(){var e=this,t="config/latest/2/web/configuration.json";-1!==this.url.indexOf("MoxieTest=true")&&sessionStorage.setItem("MoxieConfigCacheBust","true"),"true"===sessionStorage.getItem("MoxieConfigCacheBust")&&(t+="?cacheBuster="+Date.now());var n=this.httpGet(e.scriptLocationWithBrand+"/"+t).catch((function(n){if(""===e.brandPrefix)throw console.error("Concierge could not load configuration.json"),n;return e.scriptLocationWithBrand=e.scriptLocation,e.brandPrefix="",e.brandId=0,console.error("Concierge could not load configuration.json for brand. Retrying with default"),e.httpGet(e.scriptLocation+"/"+t)}));return this.apiReady=L.all([n.then((function(t){return e.configuration=t,e.assetVersion.widgets=t.widgets.version,e.localization.init(),e.widgetManager.preloadCSS()})),e.cacheManager.init()]).then((function(){return e.contextMonitor.initTracking()})).then((function(){return e.widgetManager.init(),e.rulesEngine.init(e.configuration),e.widgetManager.loadActiveWidgets()})).then((function(){return function(e,t){var n=new Kn(e,t,"1.0");try{window.dispatchEvent(n)}catch(t){xe.log("PublicAPI.broadcastNow("+e+"): error: "+(t.stack?t.stack:t.message))}return n}("apiReady")})),this.apiReady},is.prototype.init=function(){var e,t=this;return this.ready=this.initAPI().then((e=function(){return t.contextMonitor.start(),t.rulesEngine.run(),t.widgetManager.addEventListeners(t.widgetManager),t.widgetManager.showConcierge(),t.widgetManager.fixPosition(t.positionMethod),be(t),Xn("conciergeReady"),t.loadState="READY",!0},function(){return"LOADING"===t.loadState?e():null})),this.ready.catch((function(e){t.loadState="FAILED",t.logError("Concierge Unexpected Error",e),Xn("conciergeFailedToLoad")})),this.ready};var os=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],ss=/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,cs=/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/,us=/(?:^|&)([^&=]*)=?([^&]*)/g;function ls(e){as(),this.element=e}ls.getScriptElement=function(){for(var e=document.getElementsByTagName("script"),t=0;t